[mutter] Don't cast free function passed to g_clear_pointer



commit 7fdaf7721c069348c129c23e3c80e5741fdd1b13
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jul 23 19:22:51 2018 +0200

    Don't cast free function passed to g_clear_pointer
    
    The function is intentionally provided as macro to not require a
    cast. Recently the macro was improved to check that the passed in
    pointer matches the free function, so the cast to GDestroyNotify
    is now even harmful.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/176

 clutter/clutter/evdev/clutter-seat-evdev.c        |  2 +-
 src/backends/meta-screen-cast-stream-src.c        |  6 +++---
 src/backends/native/meta-cursor-renderer-native.c |  4 ++--
 src/compositor/meta-background-actor.c            |  2 +-
 src/compositor/meta-shaped-texture.c              |  4 ++--
 src/core/display.c                                |  4 ++--
 src/wayland/meta-wayland-touch.c                  |  4 ++--
 src/wayland/meta-xwayland-selection.c             | 18 +++++++++---------
 8 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-seat-evdev.c b/clutter/clutter/evdev/clutter-seat-evdev.c
index a453b1150..9bfb75af3 100644
--- a/clutter/clutter/evdev/clutter-seat-evdev.c
+++ b/clutter/clutter/evdev/clutter-seat-evdev.c
@@ -142,7 +142,7 @@ clutter_seat_evdev_release_touch_state (ClutterSeatEvdev  *seat,
                                         ClutterTouchState *touch_state)
 {
   g_clear_pointer (&seat->touch_states[touch_state->seat_slot],
-                   (GDestroyNotify) clutter_touch_state_free);
+                   clutter_touch_state_free);
 }
 
 ClutterSeatEvdev *
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
index 0c4f33b7d..2d7a68e2a 100644
--- a/src/backends/meta-screen-cast-stream-src.c
+++ b/src/backends/meta-screen-cast-stream-src.c
@@ -578,9 +578,9 @@ meta_screen_cast_stream_src_finalize (GObject *object)
   if (meta_screen_cast_stream_src_is_enabled (src))
     meta_screen_cast_stream_src_disable (src);
 
-  g_clear_pointer (&priv->pipewire_stream, (GDestroyNotify) pw_stream_destroy);
-  g_clear_pointer (&priv->pipewire_remote, (GDestroyNotify) pw_remote_destroy);
-  g_clear_pointer (&priv->pipewire_core, (GDestroyNotify) pw_core_destroy);
+  g_clear_pointer (&priv->pipewire_stream, pw_stream_destroy);
+  g_clear_pointer (&priv->pipewire_remote, pw_remote_destroy);
+  g_clear_pointer (&priv->pipewire_core, pw_core_destroy);
   g_source_destroy (&priv->pipewire_source->base);
 
   G_OBJECT_CLASS (meta_screen_cast_stream_src_parent_class)->finalize (object);
diff --git a/src/backends/native/meta-cursor-renderer-native.c 
b/src/backends/native/meta-cursor-renderer-native.c
index e96dbd917..890a0d476 100644
--- a/src/backends/native/meta-cursor-renderer-native.c
+++ b/src/backends/native/meta-cursor-renderer-native.c
@@ -749,7 +749,7 @@ cursor_gpu_state_free (MetaCursorNativeGpuState *cursor_gpu_state)
   int i;
 
   for (i = 0; i < HW_CURSOR_BUFFER_COUNT; i++)
-    g_clear_pointer (&cursor_gpu_state->bos[i], (GDestroyNotify) gbm_bo_destroy);
+    g_clear_pointer (&cursor_gpu_state->bos[i], gbm_bo_destroy);
   g_free (cursor_gpu_state);
 }
 
@@ -789,7 +789,7 @@ on_cursor_sprite_texture_changed (MetaCursorSprite *cursor_sprite)
       guint pending_bo;
       pending_bo = get_pending_cursor_sprite_gbm_bo_index (cursor_gpu_state);
       g_clear_pointer (&cursor_gpu_state->bos[pending_bo],
-                       (GDestroyNotify) gbm_bo_destroy);
+                       gbm_bo_destroy);
       cursor_gpu_state->pending_bo_state = META_CURSOR_GBM_BO_STATE_INVALIDATED;
     }
 }
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 9475ba73b..a98f322f1 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -185,7 +185,7 @@ set_clip_region (MetaBackgroundActor *self,
 {
   MetaBackgroundActorPrivate *priv = self->priv;
 
-  g_clear_pointer (&priv->clip_region, (GDestroyNotify) cairo_region_destroy);
+  g_clear_pointer (&priv->clip_region, cairo_region_destroy);
   if (clip_region)
     priv->clip_region = cairo_region_copy (clip_region);
 }
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index eb8d19080..cd3afda95 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -160,7 +160,7 @@ set_unobscured_region (MetaShapedTexture *self,
 {
   MetaShapedTexturePrivate *priv = self->priv;
 
-  g_clear_pointer (&priv->unobscured_region, (GDestroyNotify) cairo_region_destroy);
+  g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
   if (unobscured_region)
     {
       guint width, height;
@@ -188,7 +188,7 @@ set_clip_region (MetaShapedTexture *self,
 {
   MetaShapedTexturePrivate *priv = self->priv;
 
-  g_clear_pointer (&priv->clip_region, (GDestroyNotify) cairo_region_destroy);
+  g_clear_pointer (&priv->clip_region, cairo_region_destroy);
   if (clip_region)
     priv->clip_region = cairo_region_copy (clip_region);
 }
diff --git a/src/core/display.c b/src/core/display.c
index d946ad80d..a66ddb1c6 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -931,9 +931,9 @@ meta_display_close (MetaDisplay *display,
 
   g_clear_object (&display->gesture_tracker);
 
-  g_clear_pointer (&display->stack, (GDestroyNotify) meta_stack_free);
+  g_clear_pointer (&display->stack, meta_stack_free);
   g_clear_pointer (&display->stack_tracker,
-                   (GDestroyNotify) meta_stack_tracker_free);
+                   meta_stack_tracker_free);
 
   if (display->focus_timeout_id)
     g_source_remove (display->focus_timeout_id);
diff --git a/src/wayland/meta-wayland-touch.c b/src/wayland/meta-wayland-touch.c
index 55b772588..ac17fedae 100644
--- a/src/wayland/meta-wayland-touch.c
+++ b/src/wayland/meta-wayland-touch.c
@@ -549,8 +549,8 @@ meta_wayland_touch_disable (MetaWaylandTouch *touch)
 
   meta_wayland_touch_cancel (touch);
 
-  g_clear_pointer (&touch->touch_surfaces, (GDestroyNotify) g_hash_table_unref);
-  g_clear_pointer (&touch->touches, (GDestroyNotify) g_hash_table_unref);
+  g_clear_pointer (&touch->touch_surfaces, g_hash_table_unref);
+  g_clear_pointer (&touch->touches, g_hash_table_unref);
 }
 
 void
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index d175b2e98..4a204814f 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -485,7 +485,7 @@ x11_selection_data_finish (MetaSelectionBridge *selection,
     x11_selection_data_send_finished (selection, success);
 
   g_clear_pointer (&selection->x11_selection,
-                   (GDestroyNotify) x11_selection_data_free);
+                   x11_selection_data_free);
 }
 
 static void
@@ -707,7 +707,7 @@ wayland_data_read_cb (GObject      *object,
         {
           reply_selection_request (&data->request_event, FALSE);
           g_clear_pointer (&selection->wayland_selection,
-                           (GDestroyNotify) wayland_selection_data_free);
+                           wayland_selection_data_free);
         }
 
       return;
@@ -753,7 +753,7 @@ wayland_data_read_cb (GObject      *object,
         }
 
       g_clear_pointer (&selection->wayland_selection,
-                       (GDestroyNotify) wayland_selection_data_free);
+                       wayland_selection_data_free);
     }
 }
 
@@ -868,7 +868,7 @@ meta_x11_source_cancel (MetaWaylandDataSource *source)
 
   x11_selection_data_send_finished (selection, FALSE);
   g_clear_pointer (&selection->x11_selection,
-                   (GDestroyNotify) x11_selection_data_free);
+                   x11_selection_data_free);
 }
 
 static void
@@ -1156,7 +1156,7 @@ meta_xwayland_selection_handle_selection_notify (MetaWaylandCompositor *composit
   if (event->property == None)
     {
       g_clear_pointer (&selection->x11_selection,
-                       (GDestroyNotify) x11_selection_data_free);
+                       x11_selection_data_free);
       return FALSE;
     }
 
@@ -1294,7 +1294,7 @@ meta_xwayland_selection_handle_selection_request (MetaWaylandCompositor *composi
     return FALSE;
 
   g_clear_pointer (&selection->wayland_selection,
-                   (GDestroyNotify) wayland_selection_data_free);
+                   wayland_selection_data_free);
 
   if (event->target == gdk_x11_get_xatom_by_name ("TARGETS"))
     {
@@ -1609,7 +1609,7 @@ meta_xwayland_selection_handle_xfixes_selection_notify (MetaWaylandCompositor *c
             }
 
           g_clear_pointer (&selection->x11_selection,
-                           (GDestroyNotify) x11_selection_data_free);
+                           x11_selection_data_free);
 
           XConvertSelection (xdisplay,
                              event->selection,
@@ -1748,9 +1748,9 @@ shutdown_selection_bridge (MetaSelectionBridge *selection)
   XDestroyWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
                   selection->window);
   g_clear_pointer (&selection->wayland_selection,
-                   (GDestroyNotify) wayland_selection_data_free);
+                   wayland_selection_data_free);
   g_clear_pointer (&selection->x11_selection,
-                   (GDestroyNotify) x11_selection_data_free);
+                   x11_selection_data_free);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]