Merge lp:~kaihengfeng/unity-settings-daemon/16.04-sru-fix-1571640 into lp:unity-settings-daemon/16.04

Proposed by Kai-Heng Feng
Status: Rejected
Rejected by: Sebastien Bacher
Proposed branch: lp:~kaihengfeng/unity-settings-daemon/16.04-sru-fix-1571640
Merge into: lp:unity-settings-daemon/16.04
Diff against target: 138 lines (+53/-4)
2 files modified
debian/changelog (+6/-0)
gnome-settings-daemon/gnome-settings-manager.c (+47/-4)
To merge this branch: bzr merge lp:~kaihengfeng/unity-settings-daemon/16.04-sru-fix-1571640
Reviewer Review Type Date Requested Status
Sebastien Bacher Disapprove
Review via email: mp+298104@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks but it's already included in the coming SRU Marco is working on, see https://code.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/x-sru2/+merge/298668

review: Disapprove

Unmerged revisions

4133. By Kai-Heng Feng

SettingsManager: Queue up signals before getting D-Bus connection. (LP: #1571640)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-02-09 10:03:46 +0000
3+++ debian/changelog 2016-06-22 08:33:17 +0000
4@@ -1,3 +1,9 @@
5+unity-settings-daemon (15.04.1+16.04.20160209-0ubuntu2) xenial; urgency=medium
6+
7+ * SettingsManager: Queue up signals before getting D-Bus connection. (LP: #1571640)
8+
9+ -- Kai-Heng Feng <kai.heng.feng@canonical.com> Wed, 22 Jun 2016 15:19:33 +0800
10+
11 unity-settings-daemon (15.04.1+16.04.20160209-0ubuntu1) xenial; urgency=medium
12
13 * Restore the scaling on the greeter, the menu placement is correct
14
15=== modified file 'gnome-settings-daemon/gnome-settings-manager.c'
16--- gnome-settings-daemon/gnome-settings-manager.c 2014-06-26 00:02:19 +0000
17+++ gnome-settings-daemon/gnome-settings-manager.c 2016-06-22 08:33:17 +0000
18@@ -55,6 +55,11 @@
19 " </interface>"
20 "</node>";
21
22+typedef struct {
23+ const char *signal;
24+ const char *name;
25+} SignalCache;
26+
27 struct GnomeSettingsManagerPrivate
28 {
29 guint owner_id;
30@@ -64,6 +69,7 @@
31 char **whitelist;
32 GsdPnpIds *pnp_ids;
33 GSList *plugins;
34+ GQueue *signal_queue;
35 };
36
37 static void gnome_settings_manager_class_init (GnomeSettingsManagerClass *klass);
38@@ -74,6 +80,17 @@
39
40 static gpointer manager_object = NULL;
41
42+static void signal_cache_free (SignalCache *cache)
43+{
44+ if (cache == NULL) {
45+ return;
46+ }
47+
48+ g_free (cache->signal);
49+ g_free (cache->name);
50+ g_free (cache);
51+}
52+
53 GQuark
54 gnome_settings_manager_error_quark (void)
55 {
56@@ -137,17 +154,23 @@
57 const char *name)
58 {
59 GError *error = NULL;
60+ GQueue *signal_queue = manager->priv->signal_queue;
61
62- /* FIXME: maybe we should queue those up until the D-Bus
63- * connection is available... */
64- if (manager->priv->connection == NULL)
65+ /* Queue up signal if there's no D-Bus connection */
66+ if (manager->priv->connection == NULL) {
67+ g_debug ("Connection is null, cannot emit signal, queue instead");
68+ SignalCache *cache = g_new0 (SignalCache, 1);
69+ cache->signal = g_strdup (signal);
70+ cache->name = g_strdup (name);
71+ g_queue_push_tail (signal_queue, cache);
72 return;
73+ }
74
75 if (g_dbus_connection_emit_signal (manager->priv->connection,
76 NULL,
77 GSD_DBUS_PATH,
78 GSD_DBUS_NAME,
79- "PluginActivated",
80+ signal,
81 g_variant_new ("(s)", name),
82 &error) == FALSE) {
83 g_debug ("Error emitting signal: %s", error->message);
84@@ -344,6 +367,7 @@
85 {
86 GDBusConnection *connection;
87 GError *error = NULL;
88+ GQueue *signal_queue = manager->priv->signal_queue;
89
90 connection = g_bus_get_finish (res, &error);
91 if (connection == NULL) {
92@@ -351,6 +375,7 @@
93 g_error_free (error);
94 return;
95 }
96+
97 manager->priv->connection = connection;
98
99 g_dbus_connection_register_object (connection,
100@@ -360,6 +385,16 @@
101 NULL,
102 NULL,
103 NULL);
104+
105+ /* Emit queued up signals after got D-Bus connection */
106+ if (!g_queue_is_empty (signal_queue)) {
107+ g_debug ("Emit queued up signals");
108+ while (!g_queue_is_empty (signal_queue)) {
109+ SignalCache *cache = g_queue_pop_head (signal_queue);
110+ emit_signal (manager, cache->signal, cache->name);
111+ signal_cache_free (cache);
112+ }
113+ }
114 }
115
116 static void
117@@ -396,6 +431,8 @@
118 goto out;
119 }
120
121+ manager->priv->signal_queue = g_queue_new ();
122+
123 g_debug ("loading PNPIDs");
124 manager->priv->pnp_ids = gsd_pnp_ids_new ();
125
126@@ -425,6 +462,12 @@
127 manager->priv->owner_id = 0;
128 }
129
130+ /* This will be called from both stop_manager and dispose, so we need to
131+ * prevent the queue being freed twice */
132+ if (manager->priv->signal_queue != NULL) {
133+ g_queue_free_full (manager->priv->signal_queue, signal_cache_free);
134+ manager->priv->signal_queue = NULL;
135+ }
136 g_clear_pointer (&manager->priv->whitelist, g_strfreev);
137 g_clear_object (&manager->priv->settings);
138 g_clear_object (&manager->priv->pnp_ids);

Subscribers

People subscribed via source and target branches