[gtk+] scrolled window: Protect against nameless devices
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scrolled window: Protect against nameless devices
- Date: Thu, 15 Oct 2015 20:07:47 +0000 (UTC)
commit dd3f4f29047dc87a412e1e4432d39d56bbd01e5d
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 15 16:06:15 2015 -0400
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 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 814d165..e679c4f 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]