[863/906] window: hold a ref to our GstGLDisplay

This commit is contained in:
Matthew Waters 2013-11-26 09:32:32 +11:00
parent cf7838a0b6
commit 7b031f648c
2 changed files with 5 additions and 7 deletions

View file

@ -79,15 +79,9 @@ static void gst_gl_window_default_send_message (GstGLWindow * window,
struct _GstGLWindowPrivate struct _GstGLWindowPrivate
{ {
GstGLDisplay *display;
GThread *gl_thread; GThread *gl_thread;
gboolean alive; gboolean alive;
guintptr external_gl_context;
GstGLAPI gl_api;
GError **error;
}; };
static void gst_gl_window_finalize (GObject * object); static void gst_gl_window_finalize (GObject * object);
@ -132,6 +126,8 @@ gst_gl_window_new (GstGLDisplay * display)
const gchar *user_choice; const gchar *user_choice;
static volatile gsize _init = 0; static volatile gsize _init = 0;
g_return_val_if_fail (display != NULL, NULL);
if (g_once_init_enter (&_init)) { if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0, GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0,
"glwindow element"); "glwindow element");
@ -173,7 +169,7 @@ gst_gl_window_new (GstGLDisplay * display)
return NULL; return NULL;
} }
window->priv->display = display; window->display = gst_object_ref (display);
return window; return window;
} }
@ -186,6 +182,7 @@ gst_gl_window_finalize (GObject * object)
g_weak_ref_clear (&window->context_ref); g_weak_ref_clear (&window->context_ref);
g_mutex_clear (&window->lock); g_mutex_clear (&window->lock);
gst_object_unref (window->display);
G_OBJECT_CLASS (gst_gl_window_parent_class)->finalize (object); G_OBJECT_CLASS (gst_gl_window_parent_class)->finalize (object);
} }

View file

@ -68,6 +68,7 @@ struct _GstGLWindow {
GMutex lock; GMutex lock;
GstGLDisplay *display;
GWeakRef context_ref; GWeakRef context_ref;
guintptr external_gl_context; guintptr external_gl_context;