Avoid criticals when drags end

Its seems that gtk_gesture_get_last_event may return NULL,
protect against that to avoid critical warnings.
This commit is contained in:
Matthias Clasen 2014-09-07 21:24:01 -04:00
parent 719e2157f2
commit be97bad3a0

View File

@ -607,14 +607,17 @@ multipress_released_cb (GtkGestureMultiPress *gesture,
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
GdkEventSequence *sequence;
const GdkEvent *event;
GdkDevice *source;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
source = gdk_event_get_source_device (gtk_gesture_get_last_event (GTK_GESTURE (gesture),
sequence));
if (gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN)
priv->in_button = FALSE;
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
if (event)
{
source = gdk_event_get_source_device (event);
if (source && gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN)
priv->in_button = FALSE;
}
g_signal_emit (button, button_signals[RELEASED], 0);
}