[gtk+] Avoid criticals when drags end
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Avoid criticals when drags end
- Date: Mon, 8 Sep 2014 01:29:36 +0000 (UTC)
commit be97bad3a0149b1b833b417258f8024314632516
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 7 21:24:01 2014 -0400
Avoid criticals when drags end
Its seems that gtk_gesture_get_last_event may return NULL,
protect against that to avoid critical warnings.
gtk/gtkbutton.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 9c1dcb4..4f0fdc1 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]