HI Jannik,

I have just tried your fix out with Qt4.8.6 on my linux and the patch does
fix the crash that occurted when I resized the window.  I have merged and
checked it in in the form:

#if QT_VERSION >= 0x040800
    // Required for multithreaded QGLWidget on Linux/X11, see
http://blog.qt.io/blog/2011/06/03/threaded-opengl-in-4-8/
    if (threadingModel != osgViewer::ViewerBase::SingleThreaded)
        QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif

I consider this a hack though, it illustrates that Qt itself doesn't work
properly with the design of X11, which can happily work multi-threaded if
you manage the X11 connections correctly.  osgViewer has been able to
things properly for a decade so it's really shabby that Qt can't do
straight forward things properly and forces hacks  that have a performance
overhead onto other applications.

Unfortunately Qt5 build still crashes though.  Seems Qt doesn't universally
move forward.  Two steps forward, one step back.

Robert.


On 19 March 2015 at 22:11, Jannik Heller <[email protected]> wrote:

> Hi Robert,
>
> The osgviewerQt example crashes when build with Qt4 on Linux.
>
> To reproduce this issue, use -DDESIRED_QT_VERSION=4 when building OSG,
> start the osgviewerQt example, and you will get the following crash
> (sometimes on launch, sometimes when resizing the window):
>
> [xcb] Unknown request in queue while dequeuing
> [xcb] Most likely this is a multi-threaded client and XInitThreads has not
> been called
> [xcb] Aborting, sorry about that.
> osgviewerQt: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion
> `!xcb_xlib_unknown_req_in_deq' failed.
> Aborted (core dumped)
>
> With Qt5, there is no crash, because the multithreading is currently
> disabled (see comment in osgviewerQt).
>
> This patch adds the AA_X11InitThreads flag to the QApplication setup,
> meaning QT will call XInitThreads for us. This also bumps the required QT
> version to 4.8+, because the AA_X11InitThreads flag was introduced in that
> version. If that is not acceptable, we could add a QT_VERSION >= 0x040800
> guard, or manually call XInitThreads() instead. Let me know what you think.
>
> Cheers
> Jannik
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63175#63175
>
>
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to