[gimp] modules: gimp_input_device_store_add(): bail out if the device has no parent
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] modules: gimp_input_device_store_add(): bail out if the device has no parent
- Date: Sun, 26 Jun 2011 21:40:38 +0000 (UTC)
commit ce4ab710f6bffbd7e46283f7c5bdc03bf924f824
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 26 23:39:05 2011 +0200
modules: gimp_input_device_store_add(): bail out if the device has no parent
modules/gimpinputdevicestore-gudev.c | 35 +++++++++++++++++++--------------
1 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/modules/gimpinputdevicestore-gudev.c b/modules/gimpinputdevicestore-gudev.c
index 4c703bc..072679e 100644
--- a/modules/gimpinputdevicestore-gudev.c
+++ b/modules/gimpinputdevicestore-gudev.c
@@ -293,29 +293,34 @@ gimp_input_device_store_add (GimpInputDeviceStore *store,
else
{
GUdevDevice *parent = g_udev_device_get_parent (device);
- const gchar *parent_name;
- parent_name = g_udev_device_get_sysfs_attr (parent, "name");
-
- if (parent_name)
+ if (parent)
{
- GtkTreeIter unused;
+ const gchar *parent_name;
+
+ parent_name = g_udev_device_get_sysfs_attr (parent, "name");
- if (! gimp_input_device_store_lookup (store, parent_name, &unused))
+ if (parent_name)
{
- gimp_input_device_store_insert (store, parent_name, parent_name,
- device_file);
+ GtkTreeIter unused;
+
+ if (! gimp_input_device_store_lookup (store, parent_name,
+ &unused))
+ {
+ gimp_input_device_store_insert (store,
+ parent_name, parent_name,
+ device_file);
- g_signal_emit (store, store_signals[DEVICE_ADDED], 0,
- parent_name);
+ g_signal_emit (store, store_signals[DEVICE_ADDED], 0,
+ parent_name);
- g_object_unref (parent);
- return TRUE;
+ g_object_unref (parent);
+ return TRUE;
+ }
}
- }
- g_object_unref (parent);
- return FALSE;
+ g_object_unref (parent);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]