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

Proposed by Corentin Noël
Status: Merged
Approved by: Cody Garver
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 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.
Revision history for this message
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
=== modified file 'src/Backend/App.vala'
--- src/Backend/App.vala 2014-07-07 17:01:47 +0000
+++ src/Backend/App.vala 2014-07-10 09:45:25 +0000
@@ -156,8 +156,12 @@
156 warning ("Failed to load icon: %s\n", e.message);156 warning ("Failed to load icon: %s\n", e.message);
157 }157 }
158158
159 return Slingshot.icon_theme.load_icon ("application-default-icon",159 try {
160 size, Gtk.IconLookupFlags.FORCE_SIZE);160 return Slingshot.icon_theme.load_icon ("application-default-icon",
161 size, Gtk.IconLookupFlags.FORCE_SIZE);
162 } catch (Error e) {
163 critical (e.message);
164 }
161 }165 }
162166
163 Gdk.Pixbuf icon = null;167 Gdk.Pixbuf icon = null;
@@ -276,4 +280,4 @@
276 return true;280 return true;
277 }281 }
278282
279}283}
280\ No newline at end of file284\ No newline at end of file
281285
=== modified file 'src/Backend/RelevancyService.vala'
--- src/Backend/RelevancyService.vala 2014-01-31 15:20:32 +0000
+++ src/Backend/RelevancyService.vala 2014-07-10 09:45:25 +0000
@@ -24,6 +24,7 @@
24 private Zeitgeist.DataSourceRegistry zg_dsr;24 private Zeitgeist.DataSourceRegistry zg_dsr;
25 private Gee.HashMap<string, int> app_popularity;25 private Gee.HashMap<string, int> app_popularity;
26 private bool has_datahub_gio_module = false;26 private bool has_datahub_gio_module = false;
27 private bool refreshing = false;
2728
28 private const float MULTIPLIER = 65535.0f;29 private const float MULTIPLIER = 65535.0f;
29 30
@@ -82,6 +83,14 @@
82 Idle.add (load_application_relevancies.callback, Priority.HIGH);83 Idle.add (load_application_relevancies.callback, Priority.HIGH);
83 yield;84 yield;
8485
86 /*
87 * Dont reload everything if a refresh is already running.
88 * This avoids a double free exception in libzeitgeist-2.0.
89 */
90 if (refreshing == true)
91 return;
92
93 refreshing = true;
85 int64 end = Zeitgeist.Timestamp.from_now ();94 int64 end = Zeitgeist.Timestamp.from_now ();
86 int64 start = end - Zeitgeist.Timestamp.WEEK * 4;95 int64 start = end - Zeitgeist.Timestamp.WEEK * 4;
87 Zeitgeist.TimeRange tr = new Zeitgeist.TimeRange (start, end);96 Zeitgeist.TimeRange tr = new Zeitgeist.TimeRange (start, end);
@@ -96,11 +105,8 @@
96 var ptr_arr = new GLib.GenericArray<Zeitgeist.Event> ();105 var ptr_arr = new GLib.GenericArray<Zeitgeist.Event> ();
97 ptr_arr.add (event);106 ptr_arr.add (event);
98107
99 Zeitgeist.ResultSet rs;
100
101 try {108 try {
102109 Zeitgeist.ResultSet rs = yield zg_log.find_events (tr, ptr_arr,
103 rs = yield zg_log.find_events (tr, (owned) ptr_arr,
104 Zeitgeist.StorageState.ANY,110 Zeitgeist.StorageState.ANY,
105 256,111 256,
106 Zeitgeist.ResultType.MOST_POPULAR_SUBJECTS,112 Zeitgeist.ResultType.MOST_POPULAR_SUBJECTS,
@@ -123,8 +129,10 @@
123 index++;129 index++;
124 }130 }
125 update_complete ();131 update_complete ();
132 refreshing = false;
126 } catch (Error err) {133 } catch (Error err) {
127 warning ("%s", err.message);134 critical (err.message);
135 refreshing = false;
128 return;136 return;
129 }137 }
130 }138 }
131139
=== modified file 'src/SlingshotView.vala'
--- src/SlingshotView.vala 2014-07-07 17:01:47 +0000
+++ src/SlingshotView.vala 2014-07-10 09:45:25 +0000
@@ -709,10 +709,6 @@
709 }709 }
710710
711 private void set_modality (Modality new_modality) {711 private void set_modality (Modality new_modality) {
712
713 if (modality == new_modality)
714 return;
715
716 modality = new_modality;712 modality = new_modality;
717713
718 switch (modality) {714 switch (modality) {
@@ -929,4 +925,4 @@
929 }925 }
930 }926 }
931927
932}928}
933\ No newline at end of file929\ No newline at end of file

Subscribers

People subscribed via source and target branches