summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2024-04-02 12:35:37 +1100
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-04-15 15:28:45 +0000
commit17b0b949a469df2c60a90554d34589741268263f (patch)
tree551280b4bb40124e647bdce2233d05203eb174f9
parent592f85fd6cba0a18efeb83ec4f722ac3f87af2ea (diff)
glcaopengllayer: NULL some fields when freed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6566>
-rw-r--r--subprojects/gst-plugins-base/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m10
1 files changed, 4 insertions, 6 deletions
diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m b/subprojects/gst-plugins-base/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
index e4ce6eb080..8d494f5637 100644
--- a/subprojects/gst-plugins-base/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
+++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
@@ -51,9 +51,9 @@ _init_debug (void)
- (void)dealloc {
if (self->draw_notify)
self->draw_notify (self->draw_data);
+ self->draw_notify = NULL;
- if (self->draw_context)
- gst_object_unref (self->draw_context);
+ gst_clear_object (&self->draw_context);
g_weak_ref_clear (&self->gst_gl_window_ref);
self->gst_gl_context_ref = NULL;
@@ -125,7 +125,7 @@ _context_ready (gpointer data)
if (gst_gl_context) {
fmt = gst_gl_context_cocoa_get_pixel_format (GST_GL_CONTEXT_COCOA (gst_gl_context));
- gst_object_unref (gst_gl_context);
+ gst_clear_object (&gst_gl_context);
}
if (!fmt) {
@@ -159,7 +159,6 @@ _context_ready (gpointer data)
if (!gst_gl_context) {
GST_ERROR ("failed to retrieve GStreamer GL context in CAOpenGLLayer");
- gst_clear_object (&gst_gl_context);
return NULL;
}
external_context = (CGLContextObj) gst_gl_context_get_gl_context (gst_gl_context);
@@ -174,8 +173,7 @@ _context_ready (gpointer data)
return NULL;
}
- if (self->draw_context)
- gst_object_unref (self->draw_context);
+ gst_clear_object (&self->draw_context);
if (kCGLNoError != CGLSetCurrentContext (self->gl_context)) {
GST_ERROR ("failed set cgl context %p current", self->gl_context);