mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
[357/906] x11: Don't crash when the X11 display is not available.
Error out cleanly instead of crashing when the X11 display can't be contacted.
This commit is contained in:
parent
09a2e19512
commit
b1dccdb13c
1 changed files with 33 additions and 30 deletions
|
@ -102,7 +102,7 @@ gst_gl_window_finalize (GObject * object)
|
||||||
g_mutex_lock (priv->x_lock);
|
g_mutex_lock (priv->x_lock);
|
||||||
|
|
||||||
priv->parent = 0;
|
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);
|
ret = glXMakeCurrent (priv->device, None, NULL);
|
||||||
|
@ -114,9 +114,7 @@ gst_gl_window_finalize (GObject * object)
|
||||||
XFree (priv->visual_info);
|
XFree (priv->visual_info);
|
||||||
|
|
||||||
XReparentWindow (priv->device, priv->internal_win_id, priv->root, 0, 0);
|
XReparentWindow (priv->device, priv->internal_win_id, priv->root, 0, 0);
|
||||||
|
|
||||||
XDestroyWindow (priv->device, priv->internal_win_id);
|
XDestroyWindow (priv->device, priv->internal_win_id);
|
||||||
|
|
||||||
XSync (priv->device, FALSE);
|
XSync (priv->device, FALSE);
|
||||||
|
|
||||||
while (XPending (priv->device))
|
while (XPending (priv->device))
|
||||||
|
@ -137,10 +135,9 @@ gst_gl_window_finalize (GObject * object)
|
||||||
//XCloseDisplay (priv->device);
|
//XCloseDisplay (priv->device);
|
||||||
|
|
||||||
g_debug ("display receiver closed\n");
|
g_debug ("display receiver closed\n");
|
||||||
|
|
||||||
XCloseDisplay (priv->disp_send);
|
XCloseDisplay (priv->disp_send);
|
||||||
|
|
||||||
g_debug ("display sender closed\n");
|
g_debug ("display sender closed\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->cond_send_message) {
|
if (priv->cond_send_message) {
|
||||||
g_cond_free (priv->cond_send_message);
|
g_cond_free (priv->cond_send_message);
|
||||||
|
@ -280,6 +277,8 @@ gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
||||||
g_mutex_lock (priv->x_lock);
|
g_mutex_lock (priv->x_lock);
|
||||||
|
|
||||||
priv->device = XOpenDisplay (priv->display_name);
|
priv->device = XOpenDisplay (priv->display_name);
|
||||||
|
if (priv->device == NULL)
|
||||||
|
goto no_display;
|
||||||
|
|
||||||
XSynchronize (priv->device, FALSE);
|
XSynchronize (priv->device, FALSE);
|
||||||
|
|
||||||
|
@ -410,6 +409,10 @@ gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
||||||
g_mutex_unlock (priv->x_lock);
|
g_mutex_unlock (priv->x_lock);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
|
no_display:
|
||||||
|
g_mutex_unlock (priv->x_lock);
|
||||||
|
g_object_unref (window);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
|
|
Loading…
Reference in a new issue