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 application crash.
Qt 6.11 is out! See what's new in the release blog

qt application crash.

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 4.5k Views 2 Watching
  • 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.
  • A Offline
    A Offline
    Anas_Deshmukh
    wrote on last edited by Anas_Deshmukh
    #1

    hi everyone,
    i am getting below error, dont know how to figure out what exactly goin wrong.

    [xcb] Unknown sequence number while processing queue
    [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
    [xcb] Aborting, sorry about that.
    sps_v1: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
    The program has unexpectedly finished.

    thanx in advance.

    P.S. edit : also getting
    QPixmap: It is not safe to use pixmaps outside the GUI thread

    kshegunovK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      you should provide more details about OS version/platform
      and Qt version,
      when error happens.

      Also try it on other computer.

      1 Reply Last reply
      1
      • A Anas_Deshmukh

        hi everyone,
        i am getting below error, dont know how to figure out what exactly goin wrong.

        [xcb] Unknown sequence number while processing queue
        [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
        [xcb] Aborting, sorry about that.
        sps_v1: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
        The program has unexpectedly finished.

        thanx in advance.

        P.S. edit : also getting
        QPixmap: It is not safe to use pixmaps outside the GUI thread

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        I suspect you're using the GUI classes from different threads. Please provide code to confirm or deny this.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anas_Deshmukh
          wrote on last edited by
          #4

          @mrjj @kshegunov Thanks for reply.

          result of command : lsb_release -a
          No LSB modules are available.
          Distributor ID: Ubuntu
          Description: Ubuntu 14.04.2 LTS
          Release: 14.04
          Codename: trusty

          Qt version : 4.8.6

          @kshegunov : i cant provide code, its big application.

          I am having scanner class which continuously running in thread and detecting scanner available or not and emit the signal when scanning event happen. further i used this signal to various slot as per need.

          I create one more class to monitor all USB devices including scanner which are connected.
          error occurred when specifically scanner not connected.

          I am very thankful if you suggest me correct approach to monitor all usb connection status. so that any thread wont get affected.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anas_Deshmukh
            wrote on last edited by
            #5

            meanwhile tried with flag Qt::AA_X11InitThreads. but nothing works
            for now i add below lines in .pro file

            QMAKE_CXXFLAGS += -std=c++0x -pthread
            LIBS += -pthread
            

            and add libraires in main.cpp and simply called XInitThreads();
            but after calling function XInitThreads().
            my application crash when i tried to call qmessagebox from some function.

            
            #include <thread>
            #include <X11/Xlib.h>
            
            Q_DECL_EXPORT int main(int argc, char *argv[])
            {
                QScopedPointer<QApplication> app(createApplication(argc, argv));
            
                XInitThreads();  // if coment  -  `!xcb_xlib_threads_sequence_lost' failed. appeared.
            
            
            //    app->setAttribute(Qt::AA_X11InitThreads, true);  // setting flag has no effect so far
            
                QmlApplicationViewer viewer;
            ...
            ...
            
            }
            
            // test.cpp
            
            someFunction() {
            ...
                QMessageBox *msgBox = new QMessageBox();
                int retValue=msgBox->exec(); // crash here.
            ...
            }
            
            1 Reply Last reply
            0
            • A Offline
              A Offline
              Anas_Deshmukh
              wrote on last edited by
              #6

              Hi everyone,

              I read about Qt::AA_X11InitThreads and it clearly mention as "Calls XInitThreads() as part of the QApplication construction in order to make Xlib calls thread-safe. This attribute must be set before QApplication is constructed."

              now I removed these flags from .pro file

              QMAKE_CXXFLAGS += -std=c++0x -pthread
              LIBS += -pthread
              

              and updated main.cpp file

              
              Q_DECL_EXPORT int main(int argc, char *argv[])
              {
                  QApplication::setAttribute(Qt::AA_X11InitThreads);
              
                  QScopedPointer<QApplication> app(createApplication(argc, argv));
              
              //    XInitThreads();
              //    app->setAttribute(Qt::AA_X11InitThreads, true);
              
                  QmlApplicationViewer viewer;
              
              ...
              }
              

              Problem is fixed so far. thanks.

              1 Reply Last reply
              1

              • Login

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