QMetaObject::invokeMethod with Qt::BlockingQueuedConnection from render thread

  • Hi,

    I have a QQuickFramebufferObject where I would like to call an external rendering function (written in Julia). Because Julia is not thread-safe, the rendering function must be called from the main thread. The easiest solution is to just set QSG_RENDER_LOOP to basic, but that is easy to forget and sub-optimal for other components in the scene graph.

    Looking at the scene graph documentation, I thought it would have been possible to call back into the main thread using QMetaObject::invokeMethod with a Qt::BlockingQueuedConnection from within QQuickFramebufferObject::Renderer::render, but this seems to result in a deadlock. Using just a Qt::QueuedConnection doesn't work either, because then the rendering function gets called after the context is invalidated.

    It seems that the GUI thread does not continue processing events until QQuickFramebufferObject::Renderer::render has completed, even though the docs state that the GUI thread is unblocked during render? The documentation for QQuickFramebufferObject even states: "Using queued connections or events for communication between item and renderer is also possible".



  • I have added a stand-alone test case here:

    The problem is at line 18 in fborender.cpp:

    Is the use of a Qt::BlockingQueuedConnection somehow disallowed here?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.