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 712812 - Crash and memory leak fixes for device removals
Crash and memory leak fixes for device removals
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2013-11-21 14:04 UTC by Rui Matos
Modified: 2013-11-22 10:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
device-manager: Don't emit device-removed with a finalized instance (1.17 KB, patch)
2013-11-21 14:04 UTC, Rui Matos
committed Details | Review
input-device: Fix a GArray leak (865 bytes, patch)
2013-11-21 14:05 UTC, Rui Matos
accepted-commit_now Details | Review
device-manager-xi2: Fix device instances leaking on removal (1.04 KB, patch)
2013-11-21 14:05 UTC, Rui Matos
committed Details | Review
device-manager-evdev: Unref devices on removal (882 bytes, patch)
2013-11-21 14:05 UTC, Rui Matos
committed Details | Review
device-manager-evdev: Fix a segfault on device removal (1.12 KB, patch)
2013-11-21 14:05 UTC, Rui Matos
committed Details | Review
input-device: Fix a GArray leak (859 bytes, patch)
2013-11-21 15:31 UTC, Rui Matos
committed Details | Review
input-device: Use g_clear_pointer (1.24 KB, patch)
2013-11-21 15:32 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2013-11-21 14:04:53 UTC
Found a few problems on device removals. Please review.
Comment 1 Rui Matos 2013-11-21 14:04:55 UTC
Created attachment 260435 [details] [review]
device-manager: Don't emit device-removed with a finalized instance
Comment 2 Rui Matos 2013-11-21 14:05:00 UTC
Created attachment 260436 [details] [review]
input-device: Fix a GArray leak
Comment 3 Rui Matos 2013-11-21 14:05:04 UTC
Created attachment 260437 [details] [review]
device-manager-xi2: Fix device instances leaking on removal

Don't add an extra reference when adding to the devices hash table. We
already own the initial reference.
Comment 4 Rui Matos 2013-11-21 14:05:08 UTC
Created attachment 260438 [details] [review]
device-manager-evdev: Unref devices on removal
Comment 5 Rui Matos 2013-11-21 14:05:12 UTC
Created attachment 260439 [details] [review]
device-manager-evdev: Fix a segfault on device removal

The master devices have a NULL sysfs path so use g_strcmp0 to handle
them without crashing.
Comment 6 Emmanuele Bassi (:ebassi) 2013-11-21 14:42:55 UTC
Review of attachment 260435 [details] [review]:

okay.
Comment 7 Emmanuele Bassi (:ebassi) 2013-11-21 14:43:44 UTC
Review of attachment 260436 [details] [review]:

okay, with a minor correction before pushing.

::: clutter/clutter-input-device.c
@@ +108,3 @@
+  if (device->scroll_info != NULL)
+    {
+      g_array_free (device->scroll_info, TRUE);

I'd go for g_array_unref() here.
Comment 8 Emmanuele Bassi (:ebassi) 2013-11-21 14:44:07 UTC
Review of attachment 260437 [details] [review]:

okay.
Comment 9 Emmanuele Bassi (:ebassi) 2013-11-21 14:44:22 UTC
Review of attachment 260438 [details] [review]:

okay.
Comment 10 Emmanuele Bassi (:ebassi) 2013-11-21 14:45:39 UTC
Review of attachment 260439 [details] [review]:

okay, with one minor style correction before pushing.

::: clutter/evdev/clutter-device-manager-evdev.c
@@ +945,3 @@
 
+      if (g_strcmp0 (sysfs_path,
+                     _clutter_input_device_evdev_get_sysfs_path (device)) == 0)

please, put the arguments on the same line; 80 columns are a soft limit, and I intensely dislike multi-line single conditions for if().
Comment 11 Rui Matos 2013-11-21 15:31:27 UTC
Created attachment 260457 [details] [review]
input-device: Fix a GArray leak
Comment 12 Rui Matos 2013-11-21 15:32:30 UTC
Created attachment 260458 [details] [review]
input-device: Use g_clear_pointer

--

To keep things consistent
Comment 13 Emmanuele Bassi (:ebassi) 2013-11-21 15:37:09 UTC
Review of attachment 260458 [details] [review]:

looks good.
Comment 14 Emmanuele Bassi (:ebassi) 2013-11-21 15:37:30 UTC
Review of attachment 260457 [details] [review]:

looks good.
Comment 15 Rui Matos 2013-11-22 10:22:04 UTC
Attachment 260435 [details] pushed as 1d11cc3 - device-manager: Don't emit device-removed with a finalized instance
Attachment 260437 [details] pushed as ce1f8f1 - device-manager-xi2: Fix device instances leaking on removal
Attachment 260438 [details] pushed as 7d8f72a - device-manager-evdev: Unref devices on removal
Attachment 260439 [details] pushed as 05e6bcc - device-manager-evdev: Fix a segfault on device removal
Attachment 260457 [details] pushed as 18b9384 - input-device: Fix a GArray leak
Attachment 260458 [details] pushed as 507d8b1 - input-device: Use g_clear_pointer