Merge lp:~larsu/unity-settings-daemon/lp1380278 into lp:unity-settings-daemon

Proposed by Lars Karlitski
Status: Merged
Approved by: Iain Lane
Approved revision: 4061
Merged at revision: 4055
Proposed branch: lp:~larsu/unity-settings-daemon/lp1380278
Merge into: lp:unity-settings-daemon
Diff against target: 101 lines (+11/-14)
3 files modified
gnome-settings-daemon/gsd-idle-monitor.c (+9/-10)
plugins/cursor/gsd-cursor-manager.c (+1/-3)
plugins/power/gsd-power-manager.c (+1/-1)
To merge this branch: bzr merge lp:~larsu/unity-settings-daemon/lp1380278
Reviewer Review Type Date Requested Status
Iain Lane Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+238309@code.launchpad.net

Commit message

Idle monitor: fix ref counting bugs

Description of the change

Idle monitor: fix ref counting bugs

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Iain Lane (laney) wrote :

Looks good to me, thank you

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gnome-settings-daemon/gsd-idle-monitor.c'
2--- gnome-settings-daemon/gsd-idle-monitor.c 2014-10-10 05:53:44 +0000
3+++ gnome-settings-daemon/gsd-idle-monitor.c 2014-10-14 14:37:29 +0000
4@@ -321,10 +321,10 @@
5 g_slice_free (GsdIdleMonitorWatch, watch);
6 }
7
8-GdkFilterReturn
9+static GdkFilterReturn
10 xevent_filter (GdkXEvent *xevent,
11- GdkEvent *event,
12- GsdIdleMonitor *monitor)
13+ GdkEvent *event,
14+ gpointer user_data)
15 {
16 XEvent *ev;
17
18@@ -366,7 +366,9 @@
19 monitor->user_active_alarm = None;
20 }
21
22- device_monitors[monitor->device_id] = NULL;
23+ /* The device in device_monitors is cleared when the device is
24+ * removed. Ensure that the object is not deleted before that. */
25+ g_assert_null (device_monitors[monitor->device_id]);
26
27 G_OBJECT_CLASS (gsd_idle_monitor_parent_class)->dispose (object);
28 }
29@@ -828,7 +830,6 @@
30 int device_id;
31 char *path;
32
33- g_object_ref(device);
34 device_id = gdk_x11_device_get_id (device);
35 monitor = gsd_idle_monitor_get_for_device (device_id);
36 g_object_ref(monitor);
37@@ -851,7 +852,6 @@
38 g_dbus_object_manager_server_unexport (manager, path);
39 g_free (path);
40
41- g_object_unref(device_monitors[device_id]);
42 g_clear_object (&device_monitors[device_id]);
43 if (device_id == device_id_max)
44 device_id_max--;
45@@ -896,7 +896,7 @@
46
47 g_dbus_object_manager_server_set_connection (manager, connection);
48
49- gdk_window_add_filter (NULL, (GdkFilterFunc)xevent_filter, monitor);
50+ gdk_window_add_filter (NULL, xevent_filter, NULL);
51 }
52
53 static void
54@@ -912,10 +912,9 @@
55 const char *name,
56 gpointer user_data)
57 {
58- g_debug ("Lost or failed to acquire name %s\n", name);
59+ g_warning ("Lost or failed to acquire name %s\n", name);
60
61- gdk_window_remove_filter (NULL, (GdkFilterFunc)xevent_filter, NULL);
62- //mainloop_quit();
63+ gdk_window_remove_filter (NULL, xevent_filter, NULL);
64 }
65
66 static void
67
68=== modified file 'plugins/cursor/gsd-cursor-manager.c'
69--- plugins/cursor/gsd-cursor-manager.c 2014-10-07 03:17:00 +0000
70+++ plugins/cursor/gsd-cursor-manager.c 2014-10-14 14:37:29 +0000
71@@ -147,8 +147,6 @@
72 /* Make sure that all the other devices are watched
73 * (but not the one we just stopped monitoring */
74 add_all_devices (manager, device, NULL);
75-
76- g_object_unref (device);
77 }
78
79 static gboolean
80@@ -179,7 +177,7 @@
81 }
82 g_hash_table_insert (manager->priv->monitors,
83 device,
84- monitor);
85+ g_object_ref (monitor));
86 gsd_idle_monitor_add_user_active_watch (monitor,
87 monitor_became_active,
88 manager,
89
90=== modified file 'plugins/power/gsd-power-manager.c'
91--- plugins/power/gsd-power-manager.c 2014-10-07 01:23:52 +0000
92+++ plugins/power/gsd-power-manager.c 2014-10-14 14:37:29 +0000
93@@ -3548,7 +3548,7 @@
94 "use-time-for-policy");
95
96 /* create IDLETIME watcher */
97- manager->priv->idle_monitor = gsd_idle_monitor_get_core ();
98+ manager->priv->idle_monitor = g_object_ref (gsd_idle_monitor_get_core ());
99
100 /* set up the screens */
101 g_signal_connect (manager->priv->rr_screen, "changed", G_CALLBACK (on_randr_event), manager);

Subscribers

People subscribed via source and target branches