gl: Fix leak of the whole CGL context
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Fri, 8 Jul 2022 18:38:51 +0000 (20:38 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 11 Jul 2022 11:25:54 +0000 (11:25 +0000)
This was leaking the CGL context and several resources
allocated in the context, around 70MB for a 1080p clip

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2736>

subprojects/gst-plugins-base/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m

index 3adb0cd..6b618d2 100644 (file)
@@ -352,7 +352,12 @@ gst_gl_context_cocoa_swap_buffers (GstGLContext * context)
 static void
 gst_gl_context_cocoa_destroy_context (GstGLContext *context)
 {
-  /* FIXME: Need to release context and other things? */
+  GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
+
+  if (context_cocoa->priv->gl_context != NULL) {
+    CGLDestroyContext(context_cocoa->priv->gl_context);
+    context_cocoa->priv->gl_context = NULL;
+  }
 }
 
 static guintptr