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
=== modified file 'scope/clickstore/store-query.cpp'
--- scope/clickstore/store-query.cpp 2014-12-04 11:53:36 +0000
+++ scope/clickstore/store-query.cpp 2015-01-13 16:48:02 +0000
@@ -462,9 +462,12 @@
462 // this pointer is never null during normal execution.462 // this pointer is never null during normal execution.
463 assert(searchReply);463 assert(searchReply);
464464
465 run_under_qt([=]()465 std::promise<bool> dummy_promise;
466 std::future<bool> dummy_future = dummy_promise.get_future();
467
468 run_under_qt([=, &dummy_promise]()
466 {469 {
467 auto search_cb = [this, searchReply, categoryTemplate, installedPackages](Packages packages, Packages recommends) {470 auto search_cb = [this, searchReply, categoryTemplate, installedPackages, &dummy_promise](Packages packages, Packages recommends) {
468 qDebug("search callback");471 qDebug("search callback");
469472
470 const scopes::CategoryRenderer categoryRenderer(categoryTemplate);473 const scopes::CategoryRenderer categoryRenderer(categoryTemplate);
@@ -498,13 +501,15 @@
498 }501 }
499 qDebug() << "search completed";502 qDebug() << "search completed";
500 this->finished(searchReply); //FIXME: this shouldn't be needed503 this->finished(searchReply); //FIXME: this shouldn't be needed
504
505 dummy_promise.set_value(true);
501 };506 };
502507
503 // this is the case when we do bootstrap for the first time, or it failed last time508 // this is the case when we do bootstrap for the first time, or it failed last time
504 if (impl->department_lookup.size() == 0)509 if (impl->department_lookup.size() == 0)
505 {510 {
506 qDebug() << "performing bootstrap request";511 qDebug() << "performing bootstrap request";
507 impl->search_operation = impl->index.bootstrap([this, search_cb, searchReply, installedPackages](const DepartmentList& deps, const512 impl->search_operation = impl->index.bootstrap([this, search_cb, searchReply, installedPackages, &dummy_promise](const DepartmentList& deps, const
508 HighlightList& highlights, click::Index::Error error, int) {513 HighlightList& highlights, click::Index::Error error, int) {
509 if (error == click::Index::Error::NoError)514 if (error == click::Index::Error::NoError)
510 {515 {
@@ -536,6 +541,7 @@
536 if (query().query_string().empty())541 if (query().query_string().empty())
537 {542 {
538 add_highlights(searchReply, installedPackages);543 add_highlights(searchReply, installedPackages);
544 dummy_promise.set_value(true);
539 }545 }
540 else546 else
541 {547 {
@@ -550,6 +556,7 @@
550 if (query().query_string().empty())556 if (query().query_string().empty())
551 {557 {
552 add_highlights(searchReply, installedPackages);558 add_highlights(searchReply, installedPackages);
559 dummy_promise.set_value(true);
553 }560 }
554 else // normal search561 else // normal search
555 {562 {
@@ -558,6 +565,8 @@
558 }565 }
559 }566 }
560 });567 });
568
569 dummy_future.get();
561}570}
562571
563PackageSet click::Query::get_installed_packages()572PackageSet click::Query::get_installed_packages()

Subscribers

People subscribed via source and target branches

to all changes: