Procházet zdrojové kódy

Fixes removeControl to ensure parent is detached.
Fixed #618

setaylor před 13 roky
rodič
revize
028abe5752
2 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 0 1
      gameplay/gameplay.vcxproj
  2. 2 0
      gameplay/src/Container.cpp

+ 0 - 1
gameplay/gameplay.vcxproj

@@ -335,7 +335,6 @@
     <ClInclude Include="src\AudioController.h" />
     <ClInclude Include="src\AudioController.h" />
     <ClInclude Include="src\AudioListener.h" />
     <ClInclude Include="src\AudioListener.h" />
     <ClInclude Include="src\AudioSource.h" />
     <ClInclude Include="src\AudioSource.h" />
-    <ClInclude Include="src\auto_ref.h" />
     <ClInclude Include="src\Base.h" />
     <ClInclude Include="src\Base.h" />
     <ClInclude Include="src\BoundingBox.h" />
     <ClInclude Include="src\BoundingBox.h" />
     <ClInclude Include="src\BoundingSphere.h" />
     <ClInclude Include="src\BoundingSphere.h" />

+ 2 - 0
gameplay/src/Container.cpp

@@ -278,6 +278,7 @@ void Container::removeControl(const char* id)
         Control* c = *it;
         Control* c = *it;
         if (strcmp(id, c->getId()) == 0)
         if (strcmp(id, c->getId()) == 0)
         {
         {
+            c->_parent = NULL;
             SAFE_RELEASE(c);
             SAFE_RELEASE(c);
             _controls.erase(it);
             _controls.erase(it);
             return;
             return;
@@ -293,6 +294,7 @@ void Container::removeControl(Control* control)
     {
     {
         if (*it == control)
         if (*it == control)
         {
         {
+            control->_parent = NULL;
             SAFE_RELEASE(control);
             SAFE_RELEASE(control);
             _controls.erase(it);
             _controls.erase(it);
             return;
             return;