Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLContext makeCurrent() failing from different thread

QOpenGLContext makeCurrent() failing from different thread

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jonno85uk
    wrote on last edited by
    #1

    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 ?? 0x7fffec6275c0

    Any pointers would be awesome.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jonno85uk
      wrote on last edited by
      #2

      With a bit more digging i've located the event to a QEvent::Paint in a class inheriting QOpenGLWidget

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved