QOpenGLContext makeCurrent() failing from different thread
-
Hi,
I've got an odd bug which i'm having a devil of a time catching.
Somewhere in my code I am triggering a crash (SIGABRT) with a message
Cannot make QOpenGLContext current in a different thread
I'm familiar that in order to use a QOpenGLContext in a different thread one must call doneCurrent() before moving it. However, this crash is happening internally within Qt as far as I can tell.
This is the backtrace:
1 __GI_raise raise.c 51 0x7ffff2bdce97
2 __GI_abort abort.c 79 0x7ffff2bde801
3 qt_message_fatal qlogging.cpp 1901 0x7ffff3bdfdcc
4 QMessageLogger::fatal qlogging.cpp 887 0x7ffff3bdfdcc
5 QOpenGLContext::makeCurrent qopenglcontext.cpp 969 0x7ffff44743ea
6 QOpenGLWidget::makeCurrent qopenglwidget.cpp 1159 0x7ffff4cd1b71
7 QOpenGLWidgetPrivate::render qopenglwidget.cpp 893 0x7ffff4cd1c85
8 QWidget::event qwidget.cpp 9317 0x7ffff4cb2468
9 QApplicationPrivate::notify_helper qapplication.cpp 3736 0x7ffff4c746fc
10 QApplication::notify qapplication.cpp 3483 0x7ffff4c7b7f0
11 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1060 0x7ffff3dcce98
12 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1462 0x7ffff3dcd05e
13 QWidgetPrivate::sendPaintEvent qwidget.cpp 5692 0x7ffff4cab2c5
14 QWidgetBackingStore::doSync qwidgetbackingstore.cpp 1330 0x7ffff4c83931
15 QWidgetBackingStore::sync qwidgetbackingstore.cpp 1204 0x7ffff4c84300
16 QWidgetPrivate::syncBackingStore qwidget.cpp 1956 0x7ffff4c9b5ef
17 QWidget::event qwidget.cpp 9256 0x7ffff4cb2570
18 QMainWindow::event qmainwindow.cpp 1339 0x7ffff4db4a91
19 QApplicationPrivate::notify_helper qapplication.cpp 3736 0x7ffff4c746fc
20 QApplication::notify qapplication.cpp 3483 0x7ffff4c7b7f0
21 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1060 0x7ffff3dcce98
22 QCoreApplication::sendEvent qcoreapplication.cpp 1450 0x7ffff3dcd04e
23 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1799 0x7ffff3dcf937
24 QCoreApplication::sendPostedEvents qcoreapplication.cpp 1653 0x7ffff3dcfe18
25 postEventSourceDispatch qeventdispatcher_glib.cpp 276 0x7ffff3e24c93
26 g_main_context_dispatch 0x7fffec627387
27 ?? 0x7fffec6275c0Any pointers would be awesome.
-
Hi and welcome to devnet,
Not a direct answer but taking a look at QQuickRenderControl Example might give you some inspiration since there's a multithreaded OpenGL rendering variant.