1

このエラーが発生していますQObject::installEventFilter(): Cannot filter events for objects in a different thread。メインスレッドではなく別のスレッドで GUI 操作を行うと、このエラーが発生する可能性があることを読みました。しかし、私のプログラムはシングルスレッドです。QMainwindow が 1 つあります。また、イベント フィルタをインストールすることもありません。たぶん、Qt は他のスレッドやイベント フィルターを作成しますか? コードは非常に巨大で、その部分を投稿するためのエラーがどこから来るのかわからないため、コードを投稿できません。私の質問は、エラーに関する詳細情報を取得するにはどうすればよいですか? エラーの原因となるQtの試みを正確に知ることはできますか?また、エラーにはランダムな文字があります。エラー メッセージである場合もあれば、エラー メッセージである場合もBus errorあれsegmentation faultば、問題がない場合もあります。

GDB ではスタックを取得しますが、唯一のソースは main.c で、application.exec() と呼ばれ、他のフレームは Qt ライブラリです。

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
4

1 に答える 1

4

QtCreator を使用している場合は、「qWarning() が呼び出されたときに停止する」オプションを設定します。これは、[オプション] -> [デバッガ] -> [GDB 拡張] にあります。

その後、アプリをデバッグ モード (F5) で起動します。その警告が発行されると、QtCreator はアプリを停止します。スタックをトラバースして、エラーの可能性のある場所を見つけます。

QtCreator を使用しない場合は、GDB でアプリを起動し、ブレークポイントを手動で設定してみてくださいqWarning()

于 2013-08-13T12:10:18.940 に答える