PoseView: crash related to PoseView containing many files

Due to a previous change in the incrementation of models in AddPosesTask,
PoseView containing large number of poses were prone to crash in ClearPoses().

Gaps in PoseList or other invalid memory area were introduced.

Thanks to x-ist for precious assistance in spotting those issues!
This commit is contained in:
Philippe Saint-Pierre
2012-08-08 16:36:02 -04:00
parent 0bc1be3252
commit aafb6faf57
+3 -1
View File
@@ -1394,6 +1394,7 @@ BPoseView::AddPosesTask(void* castToParams)
PRINT(("1 adding model %s to zombie list, error %s\n",
model->Name(), strerror(model->InitCheck())));
view->fZombieList->AddItem(model);
modelChunkIndex--;
continue;
}
@@ -1402,6 +1403,7 @@ BPoseView::AddPosesTask(void* castToParams)
if (!PoseVisible(model,
&(posesResult->fPoseInfos[modelChunkIndex]))) {
model->CloseNode();
modelChunkIndex--;
continue;
}
@@ -1414,7 +1416,7 @@ BPoseView::AddPosesTask(void* castToParams)
bigtime_t now = system_time();
if (!count || modelChunkIndex >= kMaxAddPosesChunk
if (!count || modelChunkIndex >= kMaxAddPosesChunk - 1
|| now > nextChunkTime) {
// keep getting models until we get <kMaxAddPosesChunk> of them
// or until 300000 runs out