(svn r22228) -Fix (r22135)[FS#4546]: Do not resort town, industry and signs list directly in OnInvalidateData(). There might be a scheduled rebuild which needs execution first. So, only set a trigger for resorting.

This commit is contained in:
frosch
2011-03-08 20:52:59 +00:00
parent 9816d168c9
commit 1a14c133c6
6 changed files with 48 additions and 11 deletions

View File

@@ -1334,6 +1334,12 @@ public:
this->vscroll->SetCapacityFromWidget(this, IDW_INDUSTRY_LIST);
}
virtual void OnPaint()
{
if (this->industries.NeedRebuild()) this->BuildSortIndustriesList();
this->DrawWidgets();
}
virtual void OnHundredthTick()
{
this->industries.ForceResort();
@@ -1342,12 +1348,14 @@ public:
virtual void OnInvalidateData(int data)
{
/* We can only set the trigger for resorting/rebuilding.
* We cannot safely resort at this point, as there might be multiple scheduled invalidations,
* and a rebuild needs to be done first though it is scheduled later. */
if (data == 0) {
this->industries.ForceRebuild();
} else {
this->industries.ForceResort();
}
this->BuildSortIndustriesList();
}
};