Commit 358eec29 authored by Matthias Clasen's avatar Matthias Clasen

DND: Avoid a use-after-free

Cancelling the gesture causes the last_event pointer to become
invalid. Make a copy of the event so we can keep using it
regardless of the gesture state.
parent 7c21a32b
......@@ -84,17 +84,21 @@ gtk_drag_source_event_cb (GtkWidget *widget,
start_x + offset_x, start_y + offset_y))
GdkEventSequence *sequence;
const GdkEvent *last_event;
GdkEvent *last_event;
guint button;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (site->drag_gesture));
last_event = gtk_gesture_get_last_event (site->drag_gesture, sequence);
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (site->drag_gesture));
last_event = gdk_event_copy (gtk_gesture_get_last_event (site->drag_gesture, sequence));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (site->drag_gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (site->drag_gesture));
gtk_drag_begin_internal (widget, site->image_def, site->target_list,
site->actions, button, last_event,
start_x, start_y);
gdk_event_free (last_event);
return TRUE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment