Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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) {
            container->embedClient(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 libc-2.19.so
    #1 abort in libc-2.19.so
    #2 __libc_message in libc-2.19.so
    #3 _int_free in libc-2.19.so
    #4 _XReply in libX11.so.6
    #5 XQueryTree in libX11.so.6
    #6 embedClient in libQtGui.so.4
    #7 embedAppInContainer in libcontroller.so
    #8 thread_proxy in libboost_thread.so.1.59.0
    #9 start_thread in libpthread-2.19.so
    #10 __clone in libc-2.19.so
    

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

    Any insights will be much appreciated.
    Thanks


  • 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