mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
glwindow: remove window from display list on quit/finalize
Fixes a possible use-after-free in the X11 backend.
This commit is contained in:
parent
d79d742492
commit
b29d61b88e
2 changed files with 9 additions and 1 deletions
|
@ -592,8 +592,11 @@ gst_gl_display_create_window (GstGLDisplay * display)
|
||||||
|
|
||||||
window = klass->create_window (display);
|
window = klass->create_window (display);
|
||||||
|
|
||||||
if (window)
|
if (window) {
|
||||||
display->windows = g_list_prepend (display->windows, window);
|
display->windows = g_list_prepend (display->windows, window);
|
||||||
|
}
|
||||||
|
GST_DEBUG_OBJECT (display, "Adding window %" GST_PTR_FORMAT
|
||||||
|
" (%p) to internal list", window, window);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
@ -625,6 +628,8 @@ gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window)
|
||||||
display->windows = g_list_delete_link (display->windows, l);
|
display->windows = g_list_delete_link (display->windows, l);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_DEBUG_OBJECT (display, "Removing window %" GST_PTR_FORMAT
|
||||||
|
" (%p) from internal list", window, window);
|
||||||
GST_OBJECT_UNLOCK (display);
|
GST_OBJECT_UNLOCK (display);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -317,6 +317,8 @@ gst_gl_window_finalize (GObject * object)
|
||||||
GstGLWindow *window = GST_GL_WINDOW (object);
|
GstGLWindow *window = GST_GL_WINDOW (object);
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
|
|
||||||
|
gst_gl_display_remove_window (window->display, window);
|
||||||
|
|
||||||
if (priv->loop)
|
if (priv->loop)
|
||||||
g_main_loop_unref (priv->loop);
|
g_main_loop_unref (priv->loop);
|
||||||
|
|
||||||
|
@ -540,6 +542,7 @@ gst_gl_window_run (GstGLWindow * window)
|
||||||
static void
|
static void
|
||||||
gst_gl_window_default_quit (GstGLWindow * window)
|
gst_gl_window_default_quit (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
|
gst_gl_display_remove_window (window->display, window);
|
||||||
g_main_loop_quit (window->priv->loop);
|
g_main_loop_quit (window->priv->loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue