[gnome-panel/wip-warnings: 5/5] addto-dialog: avoid cast between incompatible function types



commit b1fe165939b726deb9a544d50d7e694649cb8b14
Author: Sebastian Geiger <sbastig gmx net>
Date:   Mon Feb 24 16:06:31 2020 +0100

    addto-dialog: avoid cast between incompatible function types
    
    GClosureNotify expects two parameters but g_free expects only one, so
    we should wrap it in a new function.
    
    Without this GCC emits the following warning:
    warning: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, GClosure 
*)’ {aka ‘void (*)(void *, struct _GClosure *)’}

 gnome-panel/panel-addto-dialog.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gnome-panel/panel-addto-dialog.c b/gnome-panel/panel-addto-dialog.c
index 9407f8a92..7cf1c7ffc 100644
--- a/gnome-panel/panel-addto-dialog.c
+++ b/gnome-panel/panel-addto-dialog.c
@@ -214,6 +214,13 @@ panel_addto_drag_begin_cb (GtkWidget      *widget,
        g_object_unref (gicon);
 }
 
+static void
+free_drag_text (gpointer  data,
+                GClosure *closure)
+{
+       g_free (data);
+}
+
 static void
 panel_addto_setup_drag (GtkTreeView          *tree_view,
                        const GtkTargetEntry *target,
@@ -229,7 +236,7 @@ panel_addto_setup_drag (GtkTreeView          *tree_view,
        g_signal_connect_data (G_OBJECT (tree_view), "drag_data_get",
                               G_CALLBACK (panel_addto_drag_data_get_cb),
                               g_strdup (text),
-                              (GClosureNotify) g_free,
+                              free_drag_text,
                               0 /* connect_flags */);
        g_signal_connect_after (G_OBJECT (tree_view), "drag-begin",
                                G_CALLBACK (panel_addto_drag_begin_cb),


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