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. Qt Threading Issues in Linux
Forum Update on Monday, May 27th 2025

Qt Threading Issues in Linux

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.1k Views
  • 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.
  • K Offline
    K Offline
    kelano
    wrote on 16 Oct 2012, 14:49 last edited by
    #1

    Hello,

    I have been developing with Qt for some time now on my project, and we are starting to move to a more thread-oriented design. Upon moving some GL rendering widgets to other threads I have discovered some very weird behavior. It appears that if a GL Widget begins updating from another thread (boost thread or QThread) before a widget that accepts user input (such as a QTextEdit) grabs focus, I get XCB crashes that look like:

    [xcb] Too much data requested from _XRead
    [xcb] This is most likely caused by a broken X extension library
    [xcb] Aborting, sorry about that.
    hypnotizer: ../../src/xcb_io.c:735: _XRead: Assertion '!xcb_xlib_too_much_data_requested' failed.

    To test this out, I actually can make a simple modification to the GLHypnotizer demo to reproduce the crash. That demo can be found here: "http://qt-project.org/doc/qt-4.8/demos-glhypnotizer.html":http://qt-project.org/doc/qt-4.8/demos-glhypnotizer.html

    If I add the line 'mdiArea.addSubWindow(new QTextEdit(this));' at around line 313 (before the call to newThread()), then when the demo starts there will be a QTextEdit and a GL Hypnotizer Widget. If I then click on the QTextEdit to grab focus I will get the above crash every time.

    Can anyone reproduce the error on there Linux install using the above instructions? Has anyone encountered these types of issues on Linux using Qt and threading before?

    Any help would be greatly appreciated!

    --Kellen

    Note: I am using Ubuntu 12 and this crash happens in VirtualBox and non VirtualBox Ubuntu installations

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on 17 Oct 2012, 06:10 last edited by
      #2

      Hi kelano,

      all UI stuff must be done in the main thread, not in worker threads. You can prepare the data in a worker thread, but the update itself MUST be done in main.

      Might be that you change exactly treats this, as you have a "normal" widget there. If openGL can be rendered in other threads, it might be, I have no experience with OpenGL.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        abes
        wrote on 18 Oct 2012, 15:18 last edited by
        #3

        I believe he was trying the demo from:

        blog.qt.digia.com/2011/06/03/threaded-opengl-in-4-8

        and it looks like the QTextWidget is being added from the main thread (from the line number he gave).

        I've tried the demo that Qt released, and it works fine on my mac with the added QTextWidget, so maybe it's an X11 bug?

        1 Reply Last reply
        0

        1/3

        16 Oct 2012, 14:49

        • Login

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