Merge lp:~tintou/slingshot/avoid-crash into lp:~elementary-pantheon/slingshot/trunk

Proposed by Corentin Noël on 2014-07-10
Status: Merged
Approved by: Cody Garver on 2014-07-19
Approved revision: 427
Merged at revision: 428
Proposed branch: lp:~tintou/slingshot/avoid-crash
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 99 lines (+21/-13)
3 files modified
src/Backend/App.vala (+7/-3)
src/Backend/RelevancyService.vala (+13/-5)
src/SlingshotView.vala (+1/-5)
To merge this branch: bzr merge lp:~tintou/slingshot/avoid-crash
Reviewer Review Type Date Requested Status
elementary Pantheon team 2014-07-10 Pending
Review via email: mp+226264@code.launchpad.net

Commit message

* Fix startup libzeitgeist-2.0 crash
* Added an exception to App.vala
* Removed modularity check to set the right view at slingshot show ()

Description of the change

Fix crash at startup from libzeitgeist-2.0, it seems that the library isn't thread-safe…

To post a comment you must log in.
Corentin Noël (tintou) wrote :

I'm sorry, I included some unrelated changes (but tiny)
 * Added an exception to App.vala
 * Removed modularity check to set the right view at slingshot show ()

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Backend/App.vala'
2--- src/Backend/App.vala 2014-07-07 17:01:47 +0000
3+++ src/Backend/App.vala 2014-07-10 09:45:25 +0000
4@@ -156,8 +156,12 @@
5 warning ("Failed to load icon: %s\n", e.message);
6 }
7
8- return Slingshot.icon_theme.load_icon ("application-default-icon",
9- size, Gtk.IconLookupFlags.FORCE_SIZE);
10+ try {
11+ return Slingshot.icon_theme.load_icon ("application-default-icon",
12+ size, Gtk.IconLookupFlags.FORCE_SIZE);
13+ } catch (Error e) {
14+ critical (e.message);
15+ }
16 }
17
18 Gdk.Pixbuf icon = null;
19@@ -276,4 +280,4 @@
20 return true;
21 }
22
23-}
24+}
25\ No newline at end of file
26
27=== modified file 'src/Backend/RelevancyService.vala'
28--- src/Backend/RelevancyService.vala 2014-01-31 15:20:32 +0000
29+++ src/Backend/RelevancyService.vala 2014-07-10 09:45:25 +0000
30@@ -24,6 +24,7 @@
31 private Zeitgeist.DataSourceRegistry zg_dsr;
32 private Gee.HashMap<string, int> app_popularity;
33 private bool has_datahub_gio_module = false;
34+ private bool refreshing = false;
35
36 private const float MULTIPLIER = 65535.0f;
37
38@@ -82,6 +83,14 @@
39 Idle.add (load_application_relevancies.callback, Priority.HIGH);
40 yield;
41
42+ /*
43+ * Dont reload everything if a refresh is already running.
44+ * This avoids a double free exception in libzeitgeist-2.0.
45+ */
46+ if (refreshing == true)
47+ return;
48+
49+ refreshing = true;
50 int64 end = Zeitgeist.Timestamp.from_now ();
51 int64 start = end - Zeitgeist.Timestamp.WEEK * 4;
52 Zeitgeist.TimeRange tr = new Zeitgeist.TimeRange (start, end);
53@@ -96,11 +105,8 @@
54 var ptr_arr = new GLib.GenericArray<Zeitgeist.Event> ();
55 ptr_arr.add (event);
56
57- Zeitgeist.ResultSet rs;
58-
59 try {
60-
61- rs = yield zg_log.find_events (tr, (owned) ptr_arr,
62+ Zeitgeist.ResultSet rs = yield zg_log.find_events (tr, ptr_arr,
63 Zeitgeist.StorageState.ANY,
64 256,
65 Zeitgeist.ResultType.MOST_POPULAR_SUBJECTS,
66@@ -123,8 +129,10 @@
67 index++;
68 }
69 update_complete ();
70+ refreshing = false;
71 } catch (Error err) {
72- warning ("%s", err.message);
73+ critical (err.message);
74+ refreshing = false;
75 return;
76 }
77 }
78
79=== modified file 'src/SlingshotView.vala'
80--- src/SlingshotView.vala 2014-07-07 17:01:47 +0000
81+++ src/SlingshotView.vala 2014-07-10 09:45:25 +0000
82@@ -709,10 +709,6 @@
83 }
84
85 private void set_modality (Modality new_modality) {
86-
87- if (modality == new_modality)
88- return;
89-
90 modality = new_modality;
91
92 switch (modality) {
93@@ -929,4 +925,4 @@
94 }
95 }
96
97-}
98+}
99\ No newline at end of file

Subscribers

People subscribed via source and target branches