libs: display: always call close_display()
authorMichael Olbrich <m.olbrich@pengutronix.de>
Thu, 11 Jun 2020 06:25:57 +0000 (08:25 +0200)
committerMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 31 Jul 2020 09:14:43 +0000 (11:14 +0200)
All close_display() have their own checks for use_foreign_display and only
destroy locally created objects in that case.
Without this objects other than the actuall foreign display itself are
leaked.

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

gst-libs/gst/vaapi/gstvaapidisplay.c

index 4391441..5e8a135 100644 (file)
@@ -900,6 +900,7 @@ static void
 gst_vaapi_display_destroy (GstVaapiDisplay * display)
 {
   GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display);
+  GstVaapiDisplayClass *klass = GST_VAAPI_DISPLAY_GET_CLASS (display);
 
   g_clear_pointer (&priv->decoders, g_ptr_array_unref);
   g_clear_pointer (&priv->encoders, g_ptr_array_unref);
@@ -914,11 +915,8 @@ gst_vaapi_display_destroy (GstVaapiDisplay * display)
     priv->display = NULL;
   }
 
-  if (!priv->use_foreign_display) {
-    GstVaapiDisplayClass *klass = GST_VAAPI_DISPLAY_GET_CLASS (display);
-    if (klass->close_display)
-      klass->close_display (display);
-  }
+  if (klass->close_display)
+    klass->close_display (display);
 
   g_clear_pointer (&priv->display_name, g_free);
   g_clear_pointer (&priv->vendor_string, g_free);