mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-03 18:53:58 +00:00
vulkandisplay: free the list of windows on destruction
They may not have had an explicit removal from the subclass.
This commit is contained in:
parent
833c596bc5
commit
1b7e83c584
1 changed files with 18 additions and 3 deletions
|
@ -143,6 +143,16 @@ gst_vulkan_display_init (GstVulkanDisplay * display)
|
||||||
g_mutex_unlock (&display->priv->thread_lock);
|
g_mutex_unlock (&display->priv->thread_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_window_weak_ref (GWeakRef * ref)
|
||||||
|
{
|
||||||
|
if (!ref)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_weak_ref_clear (ref);
|
||||||
|
g_free (ref);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vulkan_display_finalize (GObject * object)
|
gst_vulkan_display_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
|
@ -167,6 +177,11 @@ gst_vulkan_display_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
display->event_source = NULL;
|
display->event_source = NULL;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (display);
|
||||||
|
g_list_free_full (display->windows, (GDestroyNotify) free_window_weak_ref);
|
||||||
|
display->windows = NULL;
|
||||||
|
GST_OBJECT_UNLOCK (display);
|
||||||
|
|
||||||
if (display->instance) {
|
if (display->instance) {
|
||||||
gst_object_unref (display->instance);
|
gst_object_unref (display->instance);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +340,8 @@ _compare_vulkan_window (GWeakRef * ref, GstVulkanWindow * window)
|
||||||
GstVulkanWindow *other = g_weak_ref_get (ref);
|
GstVulkanWindow *other = g_weak_ref_get (ref);
|
||||||
gboolean equal = window == other;
|
gboolean equal = window == other;
|
||||||
|
|
||||||
gst_object_unref (other);
|
if (other)
|
||||||
|
gst_object_unref (other);
|
||||||
|
|
||||||
return !equal;
|
return !equal;
|
||||||
}
|
}
|
||||||
|
@ -365,8 +381,7 @@ gst_vulkan_display_remove_window (GstVulkanDisplay * display,
|
||||||
if (l) {
|
if (l) {
|
||||||
GWeakRef *ref = l->data;
|
GWeakRef *ref = l->data;
|
||||||
display->windows = g_list_delete_link (display->windows, l);
|
display->windows = g_list_delete_link (display->windows, l);
|
||||||
g_weak_ref_clear (ref);
|
free_window_weak_ref (ref);
|
||||||
g_free (ref);
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (display);
|
GST_OBJECT_UNLOCK (display);
|
||||||
|
|
Loading…
Reference in a new issue