From ee9791b9290cd6ec6d0169aefb1a5400beabc11e Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 16 Jul 2009 18:20:41 +0000 Subject: [PATCH] *** empty log message *** --- boxstack.cc | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/boxstack.cc b/boxstack.cc index 3d72fe9..cbf2dac 100644 --- a/boxstack.cc +++ b/boxstack.cc @@ -234,22 +234,29 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate) 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 -- 2.39.5