From aeda2ad049efb17171eb6cfd9ca46e542f8b50ed Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 25 Apr 2018 02:10:01 +0200 Subject: [PATCH] notebook: Fetch directly current event state/device gtk_get_current_event() returns a new reference to the event, it should be freed across various return branches to avoid the event leak, or we just fetch the little stuff we're interested in. --- gtk/gtknotebook.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index a168b115d6..57b554adb3 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -2671,15 +2671,12 @@ gtk_notebook_motion (GtkEventController *controller, GtkNotebookPrivate *priv = notebook->priv; GtkNotebookPage *page; guint state; - GdkEventMotion *event; - - event = (GdkEventMotion *)gtk_get_current_event (); /* FIXME: controller event */ page = priv->cur_page; if (!page) return; - if (!gdk_event_get_state ((GdkEvent *) event, &state)) + if (!gtk_get_current_event_state (&state)) return; if (!(state & GDK_BUTTON1_MASK) && @@ -2701,7 +2698,7 @@ gtk_notebook_motion (GtkEventController *controller, priv->detached_tab = priv->cur_page; gtk_drag_begin_with_coordinates (widget, - gdk_event_get_device ((GdkEvent*) event), + gtk_get_current_event_device (), priv->source_targets, GDK_ACTION_MOVE, priv->drag_begin_x, priv->drag_begin_y); return;