mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-24 13:45:47 +00:00
Fix missed logic bugs in reordering of RenderObjects within a layer.
Because of wrongly set firstFreeIdx some pointers were NULL, where they shouldn't be, which caused hard to track down crashes. This is an addition to af04d0c37698.
This commit is contained in:
parent
99375127e1
commit
ac822ec91d
1 changed files with 4 additions and 6 deletions
|
@ -242,7 +242,8 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
|||
r->setIdx(size);
|
||||
for (int i = size+1; i < newSize; i++)
|
||||
renderObjects[i] = 0;
|
||||
firstFreeIdx = curIdx;
|
||||
if (firstFreeIdx > curIdx)
|
||||
firstFreeIdx = curIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -261,13 +262,10 @@ void RenderObjectLayer::moveToFront(RenderObject *r)
|
|||
}
|
||||
renderObjects[lastUsed] = r;
|
||||
r->setIdx(lastUsed);
|
||||
firstFreeIdx = curIdx;
|
||||
firstFreeIdx = 0;
|
||||
// Known to have at least one NULL-element
|
||||
while (renderObjects[firstFreeIdx])
|
||||
{
|
||||
firstFreeIdx++;
|
||||
if(firstFreeIdx >= size)
|
||||
firstFreeIdx = 0;
|
||||
}
|
||||
}
|
||||
#endif // RLT_FIXED
|
||||
#ifdef RLT_DYNAMIC
|
||||
|
|
Loading…
Reference in a new issue