list-view: Guard against null event in ::released

Until 3.22.31 or 3.24.0 is released with
4d2b39d98c,
this will act as a workaround for ::released being emitted after ::cancel due
to a grab.
This commit is contained in:
Ernestas Kulik 2018-05-28 12:48:37 +03:00
parent 487213ad9b
commit 20afa56cb5

View file

@ -872,23 +872,31 @@ on_tree_view_multi_press_gesture_released (GtkGestureMultiPress *gesture,
{
NautilusListView *view;
guint button;
GdkEventSequence *sequence;
const GdkEvent *event;
view = NAUTILUS_LIST_VIEW (callback_data);
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
if (button != view->details->drag_button)
{
return;
}
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
view->details->drag_button = 0;
if (!view->details->drag_started && !view->details->ignore_button_release)
{
GdkEventSequence *sequence;
const GdkEvent *event;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
/* Typically will only happen with GTK+ <= 3.22.30 and <= 3.93.0,
* where ::released is emitted after ::cancel, but cant hurt to guard
* against it anyway.
*/
if (event == NULL)
{
return;
}
nautilus_list_view_did_not_drag (view, event);
}
}