Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for update");
// Get the z index of the box
- int z;
- for (z = 0; z < numBoxes; z++)
+ int z = 0;
+ if (toUpdate)
{
- if (boxes[z] == toUpdate) break;
- }
+ for (z = 0; z < numBoxes; z++)
+ {
+ if (boxes[z] == toUpdate) break;
+ }
- if (z == numBoxes)
+ if (z == numBoxes)
+ {
+ // not a Box we have!
+ #ifndef WIN32
+ pthread_mutex_unlock(&boxLock);
+ #else
+ ReleaseMutex(boxLock);
+ #endif
+ Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for update! box not inside boxstack");
+ return;
+ }
+ }
+ else
{
- // not a Box we have!
-#ifndef WIN32
- pthread_mutex_unlock(&boxLock);
-#else
- ReleaseMutex(boxLock);
-#endif
- Log::getInstance()->log("BoxStack", Log::ERR, "Unlocked for update! box not inside boxstack");
- return;
+ toUpdate = boxes[0];
}
// get the region for the whole box, could be less than that