Alexander Nicolaysen Sørnes : objectManager: Prevent possible problems when moving child objects

Chris Morgan cmorgan at winehq.org
Mon Dec 17 19:56:43 CST 2007


Module: appdb
Branch: master
Commit: 3ad7c4589079c7222fc6a0aabb386ae55bd31036
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=3ad7c4589079c7222fc6a0aabb386ae55bd31036

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Mon Dec 17 19:29:34 2007 +0100

objectManager: Prevent possible problems when moving child objects

---

 include/objectManager.php |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/objectManager.php b/include/objectManager.php
index 066e561..55d1c75 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -30,6 +30,13 @@ class ObjectManager
     // queued entries
     private $aCommonResponses;
 
+    /* Remove the cached object of the class we are working with, useful in cases where we
+       modify the object in such a way that it needs to be reloaded */
+    private function flushCachedObject()
+    {
+        $this->oObject = null;
+    }
+
     /* Get an instance of the object of the class we are working with */
     private function getObject()
     {
@@ -836,6 +843,9 @@ class ObjectManager
 
         $iAffected = $oObject->objectMoveChildren($iNewId);
 
+        /* Some classes record the id of their child objects, so we shouldn't keep an old instance around */
+        $this->flushCachedObject();
+
         if($iAffected)
         {
             $sPlural = ($iAffected == 1) ? "": "s";




More information about the wine-cvs mailing list