rem: while (gtx->priv->display)
add: while (gtx->priv->display != NULL && gtx->priv->stream != NULL)
context: xine_thread (void *gtx_gen){	GtkXine *gtx = (GtkXine *) gtx_gen;	XEvent event;	gtx->priv->init_finished = TRUE;	while (gtx->priv->display)	{		XNextEvent (gtx->priv->display, &event);		switch (event.type)		{		case Expose:			if (event.xexpose.count != 0)				break;			xine_gui_send_vo_data (gtx->priv->stream,					XINE_GUI_SEND_EXPOSE_EVENT,					&event);			break;		case MotionNotify:			generate_mouse_event (gtx, &event, TRUE);			if (gtx->priv->fullscreen_mode == TRUE)			{				GtkXineSignal *signal;				signal = g_new0 (GtkXineSignal, 1);				signal->type = MOUSE_MOTION;				g_async_queue_push (gtx->priv->queue, signal);				g_idle_add ((GSourceFunc) gtk_xine_idle_signal,						gtx);			}			break;		case ButtonPress:			generate_mouse_event (gtx, &event, FALSE);			break;		case KeyPress:			if (gtx->priv->fullscreen_mode == TRUE)			{				GtkXineSignal *signal;				char buf[16];				KeySym keysym;				static XComposeStatus compose;				signal = g_new0 (GtkXineSignal, 1);				signal->type = KEY_PRESS;				XLookupString (&event.xkey, buf, 16,						&keysym, &compose);				signal->keyval = keysym;				g_async_queue_push (gtx->priv->queue, signal);				g_idle_add ((GSourceFunc) gtk_xine_idle_signal,						gtx);			}			break;		}		if (event.type == gtx->priv->completion_event)		{			xine_gui_send_vo_data (gtx->priv->stream,					XINE_GUI_SEND_COMPLETION_EVENT,					&event);		}	}	pthread_exit (NULL);	return NULL;}