Xlib unexpected async



Hi to all,

I know that this question has been asked before, but did not find
a suitable solution for me. I get this

Xlib: unexpected async reply (sequence 0x1013)!

error message again and again.

I try to display a video window with OpenGL. It works fine for
the first ten frames, but then crashes. 
I read the mailing list, and yes, there is a g_thread_init(0) in the
main function, as well as
gdk_threads_enter();
gtk_main();
gdk_threads_leave();
in the main.cc

When i try to add gdk_threads_enter() in my drawing routine, the 
whole system hangs and nothing is shown.

I know that this error is produced if more than one routine tries to 
talk to the X server, but how an i stop this ?? tried several things,
nothing worked :-(

My drawing routine is:

gint RecClient::refreshGdkGLVideo(GtkWidget *draw, GdkEvent *pEvent,
                                  gpointer data)
{
    cout << " Expose Video " << endl;
    // Timeline abfragen ...
    TimeLine *lTl = (TimeLine *) data;
    
    /* if(my_images->next != NULL)
       my_images = my_images->next;
       else if(my_images->prev != NULL)
       my_images = my_images->prev;
    */
    Video::glxContext = glXCreateContext(GDK_DISPLAY(), Video::mVisual,
                                         NULL, TRUE);
    glXMakeCurrent(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(draw->window),
                   Video::glxContext);

    pthread_mutex_lock(&Video::video_mutex);
    // gdk_threads_enter();
    // glXWaitX();
    if(draw->window) {
	glDrawBuffer(GL_BACK);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear
                                          // Screen And Depth Buffer
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, Video::texture);
	glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
	
	if( Video::my_images ) {
	    gluBuild2DMipmaps( GL_TEXTURE_2D, // GLenum target,
			       3, //    GLint components,
			       Video::my_images->width, // GLint width,
			       Video::my_images->height, //GLint height,
			       GL_RGB, //    GLenum format,
			       GL_UNSIGNED_BYTE, //    GLenum type,
			       Video::my_images->data); // const void 
                                                        // *data )
	    glBegin(GL_QUADS);
	    glTexCoord2d(0.0, 0.0); glVertex2d(0.0, 1.0);
	    glTexCoord2d(1.0, 0.0); glVertex2d(1.0, 1.0);
	    glTexCoord2d(1.0, 1.0); glVertex2d(1.0, 0.0);
	    glTexCoord2d(0.0, 1.0); glVertex2d(0.0, 0.0);
	    glEnd();
	    
	    glXWaitGL();
	    // glFlush();
	    glXSwapBuffers(GDK_DISPLAY(),
                           GDK_WINDOW_XWINDOW(draw->window));
	    // glFlush();
	}
    }
    // glXWaitGL();
    pthread_mutex_unlock(&Video::video_mutex);
    return TRUE;
} 


Many thank in advance

Stephan



p.S.: I'm not on the mailing list, so please reply dircetly.
      Anyway, i can read the mail online as well ( I hope :).

--
Stephan Schwichtenberg

LMR -- Laboratory of Mixed Realities
phone:  +49 (0)221 250-1050
fax:    +49 (0)221 250-2050

http://www.lmr.khm.de
--





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]