这里触发 "ASSERT failure in QCoreApplication::sendEvent" 的是什么?
What is triggering "ASSERT failure in QCoreApplication::sendEvent" here?
我收到此 错误: ASSERT 在 QCoreApplication::sendEvent 中失败:“无法将事件发送到其他线程拥有的对象。当前线程0x0x20e51b65eb0。接收器 'gw2g'(类型 'gw2g')是在线程 0x0x20e4fd0c930"
中创建的
调试:
MAIN_thread started: QThread(0x20e4fd0c930)
DUMMY_LOOP started: QThread(0x20e51b65eb0)
什么可能导致此错误?
gw2g.cpp
addExtenders()
{
//...model gets set etc
//
connect(this, SIGNAL(xprep_ready(bool)), ui->connectButton, SLOT(setEnabled(bool)), Qt::AutoConnection);
connect(ui->listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(prep_connectx(QItemSelection)), Qt::AutoConnection);
}
在使用断点进行调试时,我发现在离开 addExtenders() 后出现此错误
我还在 dummyMain_c 和 gw2g 的析构函数中设置了断点,它们都没有被意外破坏。 有时 dummyMain_c 确实被意外破坏了。
(Press Retry to debug the application)
QCoreApplication::exec: The event loop is already running
可能跟这个有关event_loop
emit extend_list();
wait_xcon.exec();
单击 GUI 中的其中一个按钮时会退出。
QObject::connect(mwindow.ui->connectButton, &QPushButton::clicked, &dummy_main.wait_xcon, &QEventLoop::quit);
不幸的是,我什至没有讲到那部分。
图中的线程是主线程(0x0x2059fdfd9b0)和虚拟线程(0x0x205a1c85ff0)
我还检查了主线程中的所有主要 window 函数是否 运行 - 它们确实如此。
所以所有 GUI 的东西都发生在 main - 我不知道了。
我想通了。
错误消息非常具有误导性,因为问题出在 dummy 中的 QEventLoop。
当主 window(gw2g) QPushButton 被点击时它退出这个事件循环,那么为什么接收者 (gw2g) 是?
所以,我刚刚摆脱了
wait_xcon.exec();
并将其替换为简单的
while(!quitloop){}
现在单击按钮会将此布尔值设置为 true
我收到此 错误: ASSERT 在 QCoreApplication::sendEvent 中失败:“无法将事件发送到其他线程拥有的对象。当前线程0x0x20e51b65eb0。接收器 'gw2g'(类型 'gw2g')是在线程 0x0x20e4fd0c930"
中创建的调试:
MAIN_thread started: QThread(0x20e4fd0c930)
DUMMY_LOOP started: QThread(0x20e51b65eb0)
什么可能导致此错误?
gw2g.cpp
addExtenders()
{
//...model gets set etc
//
connect(this, SIGNAL(xprep_ready(bool)), ui->connectButton, SLOT(setEnabled(bool)), Qt::AutoConnection);
connect(ui->listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(prep_connectx(QItemSelection)), Qt::AutoConnection);
}
在使用断点进行调试时,我发现在离开 addExtenders() 后出现此错误
我还在 dummyMain_c 和 gw2g 的析构函数中设置了断点,它们都没有被意外破坏。 有时 dummyMain_c 确实被意外破坏了。
(Press Retry to debug the application) QCoreApplication::exec: The event loop is already running
可能跟这个有关event_loop
emit extend_list();
wait_xcon.exec();
单击 GUI 中的其中一个按钮时会退出。
QObject::connect(mwindow.ui->connectButton, &QPushButton::clicked, &dummy_main.wait_xcon, &QEventLoop::quit);
不幸的是,我什至没有讲到那部分。
图中的线程是主线程(0x0x2059fdfd9b0)和虚拟线程(0x0x205a1c85ff0)
我还检查了主线程中的所有主要 window 函数是否 运行 - 它们确实如此。 所以所有 GUI 的东西都发生在 main - 我不知道了。
我想通了。
错误消息非常具有误导性,因为问题出在 dummy 中的 QEventLoop。
当主 window(gw2g) QPushButton 被点击时它退出这个事件循环,那么为什么接收者 (gw2g) 是?
所以,我刚刚摆脱了
wait_xcon.exec();
并将其替换为简单的
while(!quitloop){}
现在单击按钮会将此布尔值设置为 true