Important: Please read the Qt Code of Conduct -

Bug when attempting embedding widget in container with thread

  • Hi All,
    I am currently working on project in which I embed an external application in a QX11EmbedContainer object. The method I use is as follows:

    int embedAppInContainer(std::string& windowHint, QX11EmbedContainer* container, time_t timeout) {
        int winID = pollWIndowID(windowHint, timeout)
        if (FAIL != winID) {
            return SUCCESS

    This method works fine when performed on the main thread with no errors and the application gets embedded as intended.

    When I pass this method to a boost::thread things get unstable :
    Most times I execute the application I get the following error - Fatal IO error: client killed - and the app crashes and generates a core file that shows the following backtrace:

    #0 raise in
    #1 abort in
    #2 __libc_message in
    #3 _int_free in
    #4 _XReply in
    #5 XQueryTree in
    #6 embedClient in
    #7 embedAppInContainer in
    #8 thread_proxy in
    #9 start_thread in
    #10 __clone in

    Every few execution the method suddenly works fine and the error doesn't occur.

    Any insights will be much appreciated.

  • Lifetime Qt Champion

    You must not do anything in the gui outside the main gui thread!

  • @Christian-Ehrlicher Understood. Thanks for your reply

Log in to reply