Merge lp:~xapantu/granite/fix-1481865 into lp:~elementary-pantheon/granite/granite

Proposed by xapantu
Status: Merged
Approved by: xapantu
Approved revision: 863
Merged at revision: 864
Proposed branch: lp:~xapantu/granite/fix-1481865
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 51 lines (+9/-4)
1 file modified
lib/Services/Settings.vala (+9/-4)
To merge this branch: bzr merge lp:~xapantu/granite/fix-1481865
Reviewer Review Type Date Requested Status
Djax (community) Approve
elementary Pantheon team Pending
Review via email: mp+267105@code.launchpad.net

Commit message

Fix bug #1481865. It looks like that disconnecting/connecting too many times sometimes does not work as expected.

Description of the change

Fix bug #1481865. It looks like that disconnecting/connecting too many times sometimes does not work as expected.

Please keep in mind that the fact that this is undefined means that the old code could perfectly work in most cases. The disconnecting/connecting can be triggered up to the number of the keys in the same iteration in normal apps. Using handler uid does not help.

I specifically encountered problem with gala notifications problem, but it is one of the only schema that is frequently modified by two different apps at the same time. So, this is very specific, and I am not aware of any other use case where it would have been detected.

To post a comment you must log in.
Revision history for this message
Djax (parnold-x) wrote :

Works good here. No regression noticed.

review: Approve
Revision history for this message
xapantu (xapantu) wrote :

So, I am going to self-approve that because no one is available to review it (I don't want to waste time fixing conflicts in 6 months when it will start bothering me again).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Services/Settings.vala'
2--- lib/Services/Settings.vala 2014-09-04 12:39:00 +0000
3+++ lib/Services/Settings.vala 2015-08-05 20:50:59 +0000
4@@ -94,6 +94,11 @@
5 public abstract class Settings : GLib.Object {
6
7 /**
8+ * Used internally to avoid mutual signal calls.
9+ */
10+ bool saving_key;
11+
12+ /**
13 * This signal is to be used in place of the standard {@link GLib.Object.notify} signal.
14 *
15 * This signal ''only'' emits after a property's value was verified.
16@@ -161,7 +166,7 @@
17 var properties = obj_class.list_properties ();
18 foreach (var prop in properties)
19 load_key (prop.name);
20-
21+
22 start_monitor ();
23 }
24
25@@ -263,7 +268,7 @@
26 }
27
28 void save_key (string key) {
29- if (key == "schema")
30+ if (key == "schema" || saving_key)
31 return;
32
33 var obj_class = (ObjectClass) get_type ().class_ref ();
34@@ -275,7 +280,7 @@
35
36 bool success = true;
37
38- stop_monitor ();
39+ saving_key = true;
40 notify.disconnect (handle_notify);
41
42 var type = prop.value_type;
43@@ -324,7 +329,7 @@
44 warning ("Key '%s' could not be written to.", key);
45
46 notify.connect (handle_notify);
47- start_monitor ();
48+ saving_key = false;
49 }
50
51 }

Subscribers

People subscribed via source and target branches