From 2d699055925a67b62a47f1e6d78abfedaa6716d0 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 13 Jun 2013 14:18:24 +1000 Subject: [PATCH] [703/906] x11: don't segfault if destroy_cb is NULL --- gst-libs/gst/gl/gstglmemory.c | 6 ++++-- gst-libs/gst/gl/x11/gstglwindow_x11.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index aac56c39e9..1d5542b387 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -73,7 +73,7 @@ _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent, gst_memory_init (GST_MEMORY_CAST (mem), GST_MEMORY_FLAG_NO_SHARE, allocator, parent, maxsize, 0, 0, maxsize); - mem->display = g_object_ref (display); + mem->display = gst_object_ref (display); mem->gl_format = GL_RGBA; mem->v_format = v_format; mem->width = width; @@ -338,7 +338,9 @@ _gl_mem_free (GstAllocator * allocator, GstMemory * mem) if (gl_mem->tex_id) gst_gl_display_del_texture (gl_mem->display, &gl_mem->tex_id); - g_object_unref (gl_mem->display); + gst_object_unref (gl_mem->upload); + gst_object_unref (gl_mem->download); + gst_object_unref (gl_mem->display); if (gl_mem->notify) gl_mem->notify (gl_mem->user_data); diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 6fa759888e..975c8f9cfd 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -696,7 +696,8 @@ gst_gl_window_x11_run (GstGLWindow * window) if (!destroy_cb || !destroy_data) GST_FIXME ("destroy cb not correctly set"); - destroy_cb (destroy_data); + if (destroy_cb) + destroy_cb (destroy_data); } else GST_DEBUG ("client message not recognized");