Remove GDestroyNotify casts in g_clear_pointer() uses

GLib master propagates argument types in g_clear_pointer(), which causes
the usual function pointer casts to GDestroyNotify to trip compiler
warnings. Additionally, this commit changes some cleanup functions where
appropriate (wl_data_source_destroy ->
gtk_primary_selection_source_destroy for struct
gtk_primary_selection_source).
This commit is contained in:
Ernestas Kulik 2018-07-25 10:00:09 +03:00
parent 95a4eff6ba
commit 6adaf7c33d
7 changed files with 12 additions and 12 deletions

View File

@ -52,13 +52,13 @@ static void
gdk_wayland_clipboard_discard_offer (GdkWaylandClipboard *cb)
{
g_clear_pointer (&cb->offer_formats, gdk_content_formats_unref);
g_clear_pointer (&cb->offer, (GDestroyNotify) wl_data_offer_destroy);
g_clear_pointer (&cb->offer, wl_data_offer_destroy);
}
static void
gdk_wayland_clipboard_discard_source (GdkWaylandClipboard *cb)
{
g_clear_pointer (&cb->source, (GDestroyNotify) wl_data_source_destroy);
g_clear_pointer (&cb->source, wl_data_source_destroy);
}
static void

View File

@ -1087,7 +1087,7 @@ gdk_wayland_seat_discard_pending_offer (GdkWaylandSeat *seat)
gdk_content_formats_unref (ignore);
seat->pending_builder = NULL;
}
g_clear_pointer (&seat->pending_offer, (GDestroyNotify) wl_data_offer_destroy);
g_clear_pointer (&seat->pending_offer, wl_data_offer_destroy);
seat->pending_source_actions = 0;
seat->pending_action = 0;
}

View File

@ -78,8 +78,8 @@ gdk_wayland_drag_finalize (GObject *object)
gdk_drag_set_cursor (drag, NULL);
g_clear_pointer (&wayland_drag->data_source, (GDestroyNotify) wl_data_source_destroy);
g_clear_pointer (&wayland_drag->offer, (GDestroyNotify) wl_data_offer_destroy);
g_clear_pointer (&wayland_drag->data_source, wl_data_source_destroy);
g_clear_pointer (&wayland_drag->offer, wl_data_offer_destroy);
dnd_surface = wayland_drag->dnd_surface;

View File

@ -69,7 +69,7 @@ gdk_wayland_drop_finalize (GObject *object)
{
GdkWaylandDrop *wayland_drop = GDK_WAYLAND_DROP (object);
g_clear_pointer (&wayland_drop->offer, (GDestroyNotify) wl_data_offer_destroy);
g_clear_pointer (&wayland_drop->offer, wl_data_offer_destroy);
G_OBJECT_CLASS (gdk_wayland_drop_parent_class)->finalize (object);
}

View File

@ -62,20 +62,20 @@ gdk_wayland_primary_discard_pending (GdkWaylandPrimary *cb)
gdk_content_formats_unref (ignore);
cb->pending_builder = NULL;
}
g_clear_pointer (&cb->pending, (GDestroyNotify) gtk_primary_selection_offer_destroy);
g_clear_pointer (&cb->pending, gtk_primary_selection_offer_destroy);
}
static void
gdk_wayland_primary_discard_offer (GdkWaylandPrimary *cb)
{
g_clear_pointer (&cb->offer_formats, gdk_content_formats_unref);
g_clear_pointer (&cb->offer, (GDestroyNotify) gtk_primary_selection_offer_destroy);
g_clear_pointer (&cb->offer, gtk_primary_selection_offer_destroy);
}
static void
gdk_wayland_primary_discard_source (GdkWaylandPrimary *cb)
{
g_clear_pointer (&cb->source, (GDestroyNotify) wl_data_source_destroy);
g_clear_pointer (&cb->source, gtk_primary_selection_source_destroy);
}
static void

View File

@ -847,7 +847,7 @@ gtk_drag_content_finalize (GObject *object)
GtkDragContent *content = GTK_DRAG_CONTENT (object);
g_clear_object (&content->widget);
g_clear_pointer (&content->formats, (GDestroyNotify) gdk_content_formats_unref);
g_clear_pointer (&content->formats, gdk_content_formats_unref);
G_OBJECT_CLASS (gtk_drag_content_parent_class)->finalize (object);
}

View File

@ -3253,7 +3253,7 @@ scrolled_window_deceleration_cb (GtkWidget *widget,
gtk_adjustment_set_value (hadjustment, position);
}
else if (data->hscrolling)
g_clear_pointer (&data->hscrolling, (GDestroyNotify) gtk_kinetic_scrolling_free);
g_clear_pointer (&data->hscrolling, gtk_kinetic_scrolling_free);
if (data->vscrolling &&
gtk_kinetic_scrolling_tick (data->vscrolling, elapsed, &position))
@ -3262,7 +3262,7 @@ scrolled_window_deceleration_cb (GtkWidget *widget,
gtk_adjustment_set_value (vadjustment, position);
}
else if (data->vscrolling)
g_clear_pointer (&data->vscrolling, (GDestroyNotify) gtk_kinetic_scrolling_free);
g_clear_pointer (&data->vscrolling, gtk_kinetic_scrolling_free);
if (!data->hscrolling && !data->vscrolling)
{