more "thread safe" fix to save list refreshing problem
This commit is contained in:
parent
1a2e3a11fc
commit
65a31bb1d1
@ -37,6 +37,7 @@ SearchController::SearchController(ControllerCallback * callback):
|
|||||||
nextQueryTime(0.0f),
|
nextQueryTime(0.0f),
|
||||||
nextQueryDone(true),
|
nextQueryDone(true),
|
||||||
instantOpen(false),
|
instantOpen(false),
|
||||||
|
doRefresh(false),
|
||||||
searchModel(NULL)
|
searchModel(NULL)
|
||||||
{
|
{
|
||||||
searchModel = new SearchModel();
|
searchModel = new SearchModel();
|
||||||
@ -61,7 +62,14 @@ void SearchController::ReleaseLoadedSave()
|
|||||||
|
|
||||||
void SearchController::Update()
|
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;
|
nextQueryDone = true;
|
||||||
searchModel->UpdateSaveList(1, nextQuery);
|
searchModel->UpdateSaveList(1, nextQuery);
|
||||||
@ -121,8 +129,7 @@ void SearchController::DoSearch(std::string query, bool now)
|
|||||||
|
|
||||||
void SearchController::Refresh()
|
void SearchController::Refresh()
|
||||||
{
|
{
|
||||||
ClearSelection();
|
doRefresh = true;
|
||||||
searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchController::PrevPage()
|
void SearchController::PrevPage()
|
||||||
|
@ -22,6 +22,7 @@ private:
|
|||||||
std::string nextQuery;
|
std::string nextQuery;
|
||||||
bool nextQueryDone;
|
bool nextQueryDone;
|
||||||
bool instantOpen;
|
bool instantOpen;
|
||||||
|
bool doRefresh;
|
||||||
void removeSelectedC();
|
void removeSelectedC();
|
||||||
void unpublishSelectedC();
|
void unpublishSelectedC();
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user