Merge lp:~unity-api-team/unity-scope-click/wait-for-add into lp:unity-scope-click

Proposed by Pete Woods
Status: Work in progress
Proposed branch: lp:~unity-api-team/unity-scope-click/wait-for-add
Merge into: lp:unity-scope-click
Diff against target: 60 lines (+12/-3)
1 file modified
scope/clickstore/store-query.cpp (+12/-3)
To merge this branch: bzr merge lp:~unity-api-team/unity-scope-click/wait-for-add
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Needs Fixing
PS Jenkins bot continuous-integration Approve
Unity Team Pending
Review via email: mp+246308@code.launchpad.net

Commit message

Wait for add request completion

Description of the change

Wait for add request completion

To post a comment you must log in.
305. By Pete Woods

Set the wait condition in more places

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
306. By Pete Woods

Make it compile

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
dobey (dobey) wrote :

This is extremely old and conflicts with trunk so I set it to WIP.

Unmerged revisions

306. By Pete Woods

Make it compile

305. By Pete Woods

Set the wait condition in more places

304. By Pete Woods

Wait for add_available_apps call to finish

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scope/clickstore/store-query.cpp'
2--- scope/clickstore/store-query.cpp 2014-12-04 11:53:36 +0000
3+++ scope/clickstore/store-query.cpp 2015-01-13 16:48:02 +0000
4@@ -462,9 +462,12 @@
5 // this pointer is never null during normal execution.
6 assert(searchReply);
7
8- run_under_qt([=]()
9+ std::promise<bool> dummy_promise;
10+ std::future<bool> dummy_future = dummy_promise.get_future();
11+
12+ run_under_qt([=, &dummy_promise]()
13 {
14- auto search_cb = [this, searchReply, categoryTemplate, installedPackages](Packages packages, Packages recommends) {
15+ auto search_cb = [this, searchReply, categoryTemplate, installedPackages, &dummy_promise](Packages packages, Packages recommends) {
16 qDebug("search callback");
17
18 const scopes::CategoryRenderer categoryRenderer(categoryTemplate);
19@@ -498,13 +501,15 @@
20 }
21 qDebug() << "search completed";
22 this->finished(searchReply); //FIXME: this shouldn't be needed
23+
24+ dummy_promise.set_value(true);
25 };
26
27 // this is the case when we do bootstrap for the first time, or it failed last time
28 if (impl->department_lookup.size() == 0)
29 {
30 qDebug() << "performing bootstrap request";
31- impl->search_operation = impl->index.bootstrap([this, search_cb, searchReply, installedPackages](const DepartmentList& deps, const
32+ impl->search_operation = impl->index.bootstrap([this, search_cb, searchReply, installedPackages, &dummy_promise](const DepartmentList& deps, const
33 HighlightList& highlights, click::Index::Error error, int) {
34 if (error == click::Index::Error::NoError)
35 {
36@@ -536,6 +541,7 @@
37 if (query().query_string().empty())
38 {
39 add_highlights(searchReply, installedPackages);
40+ dummy_promise.set_value(true);
41 }
42 else
43 {
44@@ -550,6 +556,7 @@
45 if (query().query_string().empty())
46 {
47 add_highlights(searchReply, installedPackages);
48+ dummy_promise.set_value(true);
49 }
50 else // normal search
51 {
52@@ -558,6 +565,8 @@
53 }
54 }
55 });
56+
57+ dummy_future.get();
58 }
59
60 PackageSet click::Query::get_installed_packages()

Subscribers

People subscribed via source and target branches

to all changes: