After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707901 - Minimal clean up of the evdev backend
Minimal clean up of the evdev backend
Status: RESOLVED OBSOLETE
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2013-09-11 09:49 UTC by Emmanuele Bassi (:ebassi)
Modified: 2021-06-10 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
evdev: Cache the regexp (1.17 KB, patch)
2013-09-11 09:49 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
evdev: Clean up debug and error messages (3.20 KB, patch)
2013-09-11 09:49 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
evdev: Minimal coding style fixes (1.87 KB, patch)
2013-09-11 09:50 UTC, Emmanuele Bassi (:ebassi)
reviewed Details | Review
evdev: Use a hash table of devices for faster look up (5.17 KB, patch)
2013-09-11 09:50 UTC, Emmanuele Bassi (:ebassi)
reviewed Details | Review
evdev: fix a crash when reclaiming devices (1.04 KB, patch)
2013-09-11 13:40 UTC, Giovanni Campagna
committed Details | Review

Description Emmanuele Bassi (:ebassi) 2013-09-11 09:49:32 UTC
I'd rather have somebody else test these patches, given that I can't currently test the evdev/kms backend.
Comment 1 Emmanuele Bassi (:ebassi) 2013-09-11 09:49:44 UTC
Created attachment 254658 [details] [review]
evdev: Cache the regexp

Instead of recreating it for every new device, we can cache the GRegex
and reuse it.
Comment 2 Emmanuele Bassi (:ebassi) 2013-09-11 09:49:52 UTC
Created attachment 254659 [details] [review]
evdev: Clean up debug and error messages
Comment 3 Emmanuele Bassi (:ebassi) 2013-09-11 09:50:02 UTC
Created attachment 254660 [details] [review]
evdev: Minimal coding style fixes

Do not use g_[s]list_next(), and do an explicit NULL check instead of
relying on the truthy value of a non-NULL pointer.
Comment 4 Emmanuele Bassi (:ebassi) 2013-09-11 09:50:16 UTC
Created attachment 254661 [details] [review]
evdev: Use a hash table of devices for faster look up

Instead of iterating over the list of devices.
Comment 5 Giovanni Campagna 2013-09-11 13:16:55 UTC
Review of attachment 254661 [details] [review]:

There's some unrelated whitespace change in this patch, you may want to split it out.

::: clutter/evdev/clutter-device-manager-evdev.c
@@ +915,3 @@
 
+  sysfs_path = _clutter_input_device_evdev_get_device_path (device_evdev);
+  g_hash_table_insert (priv->devices_by_path, (gpointer) sysfs_path, device);

The core keyboard/pointer won't have a sysfs path (since they're virtual devices), so you must check it.
Also, it might be good to note that devices_by_path only includes slave devices (while devices includes everything)

@@ +944,3 @@
   /* Remove the device */
+  sysfs_path = _clutter_input_device_evdev_get_device_path (device_evdev);
+  g_hash_table_remove (priv->devices_by_path, (gpointer) sysfs_path);

Same here, need to check if sysfs_path is null.
Comment 6 Giovanni Campagna 2013-09-11 13:40:49 UTC
Created attachment 254681 [details] [review]
evdev: fix a crash when reclaiming devices

That was not how you iterate a list!
Comment 7 Giovanni Campagna 2013-09-11 13:41:14 UTC
Review of attachment 254658 [details] [review]:

Yes
Comment 8 Giovanni Campagna 2013-09-11 13:41:37 UTC
Review of attachment 254659 [details] [review]:

Ok
Comment 9 Giovanni Campagna 2013-09-11 13:42:09 UTC
Review of attachment 254660 [details] [review]:

There is more g_slist_next() after this patch, you may want to remove those too.
Comment 10 Emmanuele Bassi (:ebassi) 2013-09-15 09:46:57 UTC
Review of attachment 254681 [details] [review]:

obviously correct.
Comment 11 Giovanni Campagna 2013-09-15 22:20:03 UTC
Comment on attachment 254681 [details] [review]
evdev: fix a crash when reclaiming devices

Attachment 254681 [details] pushed as b29115e - evdev: fix a crash when reclaiming devices
Comment 12 Emmanuele Bassi (:ebassi) 2013-09-19 22:13:31 UTC
Attachment 254658 [details] pushed as 9eb479a - evdev: Cache the regexp
Attachment 254659 [details] pushed as a1d29ab - evdev: Clean up debug and error messages
Comment 13 André Klapper 2021-06-10 11:32:10 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of clutter, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a ticket at
  https://gitlab.gnome.org/GNOME/clutter/-/issues/

Thank you for your understanding and your help.