From a99694cca8d01aa57150a015e8627ac4ccc83524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Qian=20Hu=20=28=E8=83=A1=E9=AA=9E=29?= Date: Fri, 21 Feb 2025 09:35:37 +0800 Subject: [PATCH] wayland: leverage unified object destruction for wl_callback This patch refactors gst_wl_display_callback_destroy() to use the recently introduced gst_wl_display_object_destroy() helper. Previously, the function manually handled wl_callback destruction with explicit lock/unlock calls and direct invocation of wl_callback_destroy(). Switching to gst_wl_display_object_destroy() unifies the destruction process across similar objects, reducing code duplication and potential errors. Part-of: --- .../gst-libs/gst/wayland/gstwldisplay.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwldisplay.c b/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwldisplay.c index 5142d3ad4b..abc8327218 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwldisplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/wayland/gstwldisplay.c @@ -590,16 +590,8 @@ void gst_wl_display_callback_destroy (GstWlDisplay * self, struct wl_callback **callback) { - GstWlDisplayPrivate *priv = gst_wl_display_get_instance_private (self); - - g_rec_mutex_lock (&priv->sync_mutex); - - if (*callback) { - wl_callback_destroy (*callback); - *callback = NULL; - } - - g_rec_mutex_unlock (&priv->sync_mutex); + gst_wl_display_object_destroy (self, (gpointer *) callback, + (GDestroyNotify) wl_callback_destroy); } struct wl_display *