Skip to content

Commit

Permalink
more "thread safe" fix to save list refreshing problem
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jan 10, 2015
1 parent 1a2e3a1 commit 65a31bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/gui/search/SearchController.cpp
Expand Up @@ -37,6 +37,7 @@ SearchController::SearchController(ControllerCallback * callback):
nextQueryTime(0.0f),
nextQueryDone(true),
instantOpen(false),
doRefresh(false),
searchModel(NULL)
{
searchModel = new SearchModel();
Expand All @@ -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);
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/gui/search/SearchController.h
Expand Up @@ -22,6 +22,7 @@ class SearchController
std::string nextQuery;
bool nextQueryDone;
bool instantOpen;
bool doRefresh;
void removeSelectedC();
void unpublishSelectedC();
public:
Expand Down

0 comments on commit 65a31bb

Please sign in to comment.