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. MultiThreaded GUI application
QtWS25 Last Chance

MultiThreaded GUI application

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.7k 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.
  • S Offline
    S Offline
    suma
    wrote on last edited by
    #1

    Hi All,
    Im getting an error like XLib:sequence Failed, X Error: BadAccess X Error: BadLenght
    and some times QGLContext:makecurrent Failed.And all these problems raised after introducing the threads. In above mentioned error list some of them ll rise because if we are trying to do some GUI related operation in the worker thread other then Main GUI thread,but in my case im doing all GUI related operation in Main thread only.But still… Can some one help me to solve these problems.
    Thank U.

    [Moved to General and Desktop since more people are going to see it there, Tobias]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      It is really heard to say anything from this information.
      Do you have some example code? small test app that shows (only) the problem?

      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
      • S Offline
        S Offline
        suma
        wrote on last edited by
        #3

        Hi, Thanks..Actually this is quiet bit big application so i myself don't know which portion of code is raising the problem,but i can explain what im doing.
        In socket im receiving the data which is thread and some calculation im doing in separate thread and painting is done in some other class which is there in main thread.
        Previously it was working fine but data reception is very fast and data was skipping so i introduced thread for receiving as well as for doing calculation also.So started to get errors like as shown above. Something like :
        XLib: Unexpected async reply after sometime it gives
        XLib:Sequence failed something like this.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #4

          Check that you function calls and signal/slot connections are really triggering all your GUI operations to happen in the main thread.

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • S Offline
            S Offline
            suma
            wrote on last edited by
            #5

            Ya im confirm about that. Problem is coming when i do PixelBuffer makecurrent(). This is the piece of code whr im getting problem:

            @
            flushData()
            {
            pixelBuffer->makeCurrent();
            glClearColor(0.5,0.5,0.5,255);
            glClear(GL_COLOR_BUFFER_BIT);
            }
            @
            Where pixelBuffer is the QGLPixelBuffer object.

            And following where im initalizing my QGLWidget:
            @
            setWidget(QWidget* w)
            {
            if( QGLPixelBuffer::hasOpenGLPbuffers() )
            {
            QGLWidget* glw = qobject_cast<QGLWidget*>(w);
            if( glw )
            {
            QGLFormatformat(QGL::Rgba|QGL::AlphaChannel,1);//
            pixelBuffer = new QGLPixelBuffer(d->size, d->size, format, glw);

                }
                else
                    pixmap = new QPixmap(d->size, d->size);
            }
            else
                pixmap = new QPixmap(d->size, d->size);
            
            // Now initialize the paint device
            if(pixelBuffer)
            {
                pixelBuffer->makeCurrent();
                glViewport(0, 0, d->size, d->size);
               glClearColor(0.5,0.5,0.5,255);
                glClear(GL_COLOR_BUFFER_BIT);
            
                textureId = pixelBuffer->generateDynamicTexture();
            

            #ifndef Q_WS_X11
            pixelBuffer->bindToDynamicTexture(textureId);
            #else
            pixelBuffer->updateDynamicTexture(textureId);
            #endif

                ((QGLWidget*)(w))->makeCurrent();
            
                dataPaintDevice = pixelBuffer;
            

            }
            @
            And one more thing that flushData() function if i call initially then no problem but after when start to read the data from the socket then problem ll rise.

            Edit: please use @ tags to delimit code blocks to make it more readable [ZapB]

            1 Reply Last reply
            0

            • Login

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