g_mutex_lock (priv->x_lock);
priv->parent = 0;
+ if (priv->device) {
+ XUnmapWindow (priv->device, priv->internal_win_id);
- XUnmapWindow (priv->device, priv->internal_win_id);
+ ret = glXMakeCurrent (priv->device, None, NULL);
+ if (!ret)
+ g_debug ("failed to release opengl context\n");
- ret = glXMakeCurrent (priv->device, None, NULL);
- if (!ret)
- g_debug ("failed to release opengl context\n");
-
- glXDestroyContext (priv->device, priv->gl_context);
-
- XFree (priv->visual_info);
-
- XReparentWindow (priv->device, priv->internal_win_id, priv->root, 0, 0);
-
- XDestroyWindow (priv->device, priv->internal_win_id);
+ glXDestroyContext (priv->device, priv->gl_context);
- XSync (priv->device, FALSE);
-
- while (XPending (priv->device))
- XNextEvent (priv->device, &event);
+ XFree (priv->visual_info);
- XSetCloseDownMode (priv->device, DestroyAll);
+ XReparentWindow (priv->device, priv->internal_win_id, priv->root, 0, 0);
+ XDestroyWindow (priv->device, priv->internal_win_id);
+ XSync (priv->device, FALSE);
- /*XAddToSaveSet (display, w)
- Display *display;
- Window w; */
+ while (XPending (priv->device))
+ XNextEvent (priv->device, &event);
- //FIXME: it seems it causes destroy all created windows, even by other display connection:
- //This is case in: gst-launch-0.10 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! glimagesink
- //When the first window is closed and so its display is closed by the following line, then the other Window managed by the
- //other glimagesink, is not useable and so each opengl call causes a segmentation fault.
- //Maybe the solution is to use: XAddToSaveSet
- //The following line is commented to avoid the disagreement explained before.
- //XCloseDisplay (priv->device);
+ XSetCloseDownMode (priv->device, DestroyAll);
- g_debug ("display receiver closed\n");
+ /*XAddToSaveSet (display, w)
+ Display *display;
+ Window w; */
- XCloseDisplay (priv->disp_send);
+ //FIXME: it seems it causes destroy all created windows, even by other display connection:
+ //This is case in: gst-launch-0.10 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! glimagesink
+ //When the first window is closed and so its display is closed by the following line, then the other Window managed by the
+ //other glimagesink, is not useable and so each opengl call causes a segmentation fault.
+ //Maybe the solution is to use: XAddToSaveSet
+ //The following line is commented to avoid the disagreement explained before.
+ //XCloseDisplay (priv->device);
- g_debug ("display sender closed\n");
+ g_debug ("display receiver closed\n");
+ XCloseDisplay (priv->disp_send);
+ g_debug ("display sender closed\n");
+ }
if (priv->cond_send_message) {
g_cond_free (priv->cond_send_message);
g_mutex_lock (priv->x_lock);
priv->device = XOpenDisplay (priv->display_name);
+ if (priv->device == NULL)
+ goto no_display;
XSynchronize (priv->device, FALSE);
g_mutex_unlock (priv->x_lock);
return window;
+no_display:
+ g_mutex_unlock (priv->x_lock);
+ g_object_unref (window);
+ return NULL;
}
GQuark