forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
7c21a32b28
commit
358eec2972
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user