Merge lp:~stolowski/unity-scope-home/fix-cancellables into lp:unity-scope-home

Proposed by Paweł Stołowski on 2013-09-20
Status: Merged
Approved by: Michal Hruby on 2013-09-20
Approved revision: 167
Merged at revision: 167
Proposed branch: lp:~stolowski/unity-scope-home/fix-cancellables
Merge into: lp:unity-scope-home
Diff against target: 40 lines (+2/-12)
1 file modified
src/scope.vala (+2/-12)
To merge this branch: bzr merge lp:~stolowski/unity-scope-home/fix-cancellables
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2013-09-20
Michal Hruby (community) 2013-09-20 Approve on 2013-09-20
Review via email: mp+186843@code.launchpad.net

Commit message

Don't maintain own instances of cancellables. Use cancellable from search context.

To post a comment you must log in.
Michal Hruby (mhr3) wrote :

Looks good, fewer objects == better :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/scope.vala'
--- src/scope.vala 2013-09-19 13:57:34 +0000
+++ src/scope.vala 2013-09-20 16:44:16 +0000
@@ -47,7 +47,6 @@
47 private SmartScopes.ChannelIdMap channel_id_map = new SmartScopes.ChannelIdMap ();47 private SmartScopes.ChannelIdMap channel_id_map = new SmartScopes.ChannelIdMap ();
48 private uint metrics_timer;48 private uint metrics_timer;
49 private int remote_scopes_retry_count = 0;49 private int remote_scopes_retry_count = 0;
50 private HashTable<string, GLib.Cancellable?> search_cancel = new HashTable<string, GLib.Cancellable?> (str_hash, str_equal);
51 private RemoteScopeRegistry remote_scope_registry;50 private RemoteScopeRegistry remote_scope_registry;
52 private uint category_reorder_time_ms = 0; // minimum time after which category reordering can happen (in milliseconds)51 private uint category_reorder_time_ms = 0; // minimum time after which category reordering can happen (in milliseconds)
53 private uint flush_delay_ms = 0; //minimum time after which results will be shown in the dash (in milliseconds)52 private uint flush_delay_ms = 0; //minimum time after which results will be shown in the dash (in milliseconds)
@@ -605,18 +604,10 @@
605604
606 init_sss_client ();605 init_sss_client ();
607606
607 GLib.Cancellable cancellable = scope_search.search_context.cancellable.get_gcancellable();
608
608 CategoryManager.instance ().observe (scope_search.channel_id, scope_search.results_model);609 CategoryManager.instance ().observe (scope_search.channel_id, scope_search.results_model);
609610
610 GLib.Cancellable? prev_search = search_cancel.lookup (scope_search.channel_id);
611 if (prev_search != null)
612 {
613 debug ("Cancelling previous search query for channel: %s", scope_search.channel_id);
614 prev_search.cancel ();
615 }
616
617 GLib.Cancellable cancellable = new GLib.Cancellable ();
618 search_cancel.insert (scope_search.channel_id, cancellable);
619
620 bool wait_for_sss_query = false;611 bool wait_for_sss_query = false;
621 bool wait_for_push = false;612 bool wait_for_push = false;
622 bool wait_for_search = false;613 bool wait_for_search = false;
@@ -1142,7 +1133,6 @@
1142 }1133 }
11431134
1144 debug ("All search activities finished");1135 debug ("All search activities finished");
1145 search_cancel.remove (scope_search.channel_id);
1146 }1136 }
11471137
1148 public override int category_index_for_scope_id (string scope_id)1138 public override int category_index_for_scope_id (string scope_id)

Subscribers

People subscribed via source and target branches

to all changes: