QObject::installEventFilter():无法为其他线程中的对象筛选事件
QObject::installEventFilter(): Cannot filter events for objects in a different thread
我收到这个错误QObject::installEventFilter(): Cannot filter events for objects in a different thread
。我读到,当不是在主线程中而是在另一个线程中执行GUI操作时,可能会出现此错误。但我的程序是单线程的。我有一个Q主窗口。此外,我从不安装任何事件过滤器。也许Qt创建了一些其他线程或事件过滤器?我不能发布代码,因为它非常巨大,我不知道从哪里来的错误发布那部分所以我的问题是如何获得有关错误的更多信息我能确切地知道Qt尝试了什么导致错误吗。此外,错误具有随机性:有时是错误消息,有时是Bus error
,有时segmentation fault
,有时没有任何问题。
有了GDB,我得到了堆栈,但唯一的来源是main.c,它被称为application.exec(),其他帧是Qt-libs
0 0x0000002a969983bc in QObject::installEventFilter () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
1 0x0000002a9625a75d in QAbstractItemView::commitData () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtGui.so.4
2 0x0000002a96991d58 in QMetaObject::activate () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
3 0x0000002a9640404f in QAbstractItemDelegate::commitData () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtGui.so.4
4 0x0000002a963184cf in QStyledItemDelegate::qt_static_metacall () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtGui.so.4
5 0x0000002a9699820e in QObject::event () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
6 0x0000002a95c75e00 in QApplicationPrivate::notify_helper () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtGui.so.4
7 0x0000002a95c7e6ff in QApplication::notify () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtGui.so.4
8 0x0000002a9697a13b in QCoreApplication::notifyInternal () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
9 0x0000002a9697c42d in QCoreApplicationPrivate::sendPostedEvents () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
10 0x0000002a969ae973 in ?? () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
11 0x000000315bc266bd in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
12 0x000000315bc28397 in ?? () from /usr/lib64/libglib-2.0.so.0
13 0x000000315bc288eb in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
14 0x0000002a969af4f5 in QEventDispatcherGlib::processEvents () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
15 0x0000002a95d2e6f9 in QGuiEventDispatcherGlib::processEvents () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtGui.so.4
16 0x0000002a96978f13 in QEventLoop::processEvents () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
17 0x0000002a969793c1 in QEventLoop::exec () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
18 0x0000002a9697c76f in QCoreApplication::exec () from /home/aminasya/checkout/ToT_test_072213/ic/ic_superproj/aof-dbg/Mgc_home//pkgs/icv_lib/lib64/libQtCore.so.4
19 0x000000000423122e in nlb::application::runGuiMode (argc=1, argv=0x7fbfffe888, args=
{mode = nlb::application::Application::MODE_GUI, databasePath = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 805}, alloc = 0, size = 0, data = 0x6b8d79a, clean
= 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 25}, alloc = 0, size = 0, data = 0x2a96bef7da, clean = 0, s
impletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x2a96bef7c0, static codecForCStrings = 0x0}, scriptPath = {static null = {<No data fields>}, static s
hared_null = {ref = {_q_value = 805}, alloc = 0, size = 0, data = 0x6b8d79a, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_emp
ty = {ref = {_q_value = 25}, alloc = 0, size = 0, data = 0x2a96bef7da, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x6b8d780, static c
odecForCStrings = 0x0}, scriptArgs = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 805}, alloc = 0, size = 0, data = 0x6b8d79a, clean = 0, simpletext = 0, righttoleft
= 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 25}, alloc = 0, size = 0, data = 0x2a96bef7da, clean = 0, simpletext = 0, righttoleft = 0, a
sciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x6b8d780, static codecForCStrings = 0x0}, help = false}, initialArgumentParsingSuccessed=true) at Isrc/NLBMain.C:366
如果您使用的是QtCreator设置的"调用qWarning()时停止"选项,该选项位于Options->Debugger->GDB Extended中。
之后,以调试模式启动您的应用程序(F5)。当发出该警告时,QtCreator将停止您的应用程序。遍历堆栈以找到可能的错误位置。
如果您不使用QtCreator,请尝试在GDB下启动应用程序,并在qWarning()
手动设置断点。
相关文章:
- 从不同线程使用int64的不同字节安全吗
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- 在C++中使用cURL和多线程
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 在cuda线程之间共享大量常量数据
- 如何将元素添加到数组的线程安全函数?
- 线程,如果else语句,都是错误的上下文切换后,会发生什么
- C++Boost Asio Pool线程,带有lambda函数和传递引用变量
- Qt C++静态thread_local QNetworkAccessManager是线程应用程序的好选择吗
- 异常属于C++中的线程还是进程
- C++中的线程安全删除
- C++使用params创建线程函数会导致转换错误
- 类与私有变量的其他类之间的线程安全性
- CoInitialize()在单独的线程上崩溃而不返回
- c++中的线程池
- 线程之间的布尔停止信号
- 为什么std::async使用同一个线程运行函数
- 用于矢量处理的多个线程
- C++为线程工作动态地分割例程
- QObject::installEventFilter():无法为其他线程中的对象筛选事件