diff --git a/src/gui/search/SearchController.cpp b/src/gui/search/SearchController.cpp index c539c67b6..b2c03dd28 100644 --- a/src/gui/search/SearchController.cpp +++ b/src/gui/search/SearchController.cpp @@ -37,6 +37,7 @@ SearchController::SearchController(ControllerCallback * callback): nextQueryTime(0.0f), nextQueryDone(true), instantOpen(false), + doRefresh(false), searchModel(NULL) { searchModel = new SearchModel(); @@ -61,7 +62,14 @@ void SearchController::ReleaseLoadedSave() void SearchController::Update() { - if(!nextQueryDone && nextQueryTime < gettime()) + if (doRefresh) + { + nextQueryDone = true; + doRefresh = false; + ClearSelection(); + searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery()); + } + else if (!nextQueryDone && nextQueryTime < gettime()) { nextQueryDone = true; searchModel->UpdateSaveList(1, nextQuery); @@ -121,8 +129,7 @@ void SearchController::DoSearch(std::string query, bool now) void SearchController::Refresh() { - ClearSelection(); - searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery()); + doRefresh = true; } void SearchController::PrevPage() diff --git a/src/gui/search/SearchController.h b/src/gui/search/SearchController.h index f2e1f6eab..403fbe7e2 100644 --- a/src/gui/search/SearchController.h +++ b/src/gui/search/SearchController.h @@ -22,6 +22,7 @@ private: std::string nextQuery; bool nextQueryDone; bool instantOpen; + bool doRefresh; void removeSelectedC(); void unpublishSelectedC(); public: