From dd3f4f29047dc87a412e1e4432d39d56bbd01e5d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 15 Oct 2015 16:06:15 -0400 Subject: [PATCH] scrolled window: Protect against nameless devices It seems that gdk_device_get_name() can return NULL. We should not crash if that happens. https://bugzilla.gnome.org/show_bug.cgi?id=756625 --- gtk/gtkscrolledwindow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 814d165e82..e679c4f2da 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1224,6 +1224,7 @@ captured_event_cb (GtkWidget *widget, GdkDevice *source_device; GtkWidget *event_widget; gboolean on_scrollbar; + const gchar *device_name; sw = GTK_SCROLLED_WINDOW (widget); priv = sw->priv; @@ -1243,6 +1244,7 @@ captured_event_cb (GtkWidget *widget, return GDK_EVENT_PROPAGATE; input_source = gdk_device_get_source (source_device); + device_name = gdk_device_get_name (source_device); if (input_source == GDK_SOURCE_KEYBOARD || input_source == GDK_SOURCE_TOUCHSCREEN) @@ -1268,8 +1270,8 @@ captured_event_cb (GtkWidget *widget, } else if (input_source == GDK_SOURCE_PEN || input_source == GDK_SOURCE_ERASER || - strstr (gdk_device_get_name (source_device), "TrackPoint") || - strstr (gdk_device_get_name (source_device), "DualPoint Stick")) + (device_name != NULL && strstr (device_name, "TrackPoint")) || + (device_name != NULL && strstr (device_name, "DualPoint Stick"))) { indicator_set_over (&priv->hindicator, TRUE); indicator_set_over (&priv->vindicator, TRUE);