ecere, ide: Fixed extra buttons/crashes in compilers
authorJerome St-Louis <jerome@ecere.com>
Fri, 22 Feb 2013 12:52:11 +0000 (07:52 -0500)
committerJerome St-Louis <jerome@ecere.com>
Fri, 22 Feb 2013 12:52:11 +0000 (07:52 -0500)
- If leaving compilers tab before closing global settings dialog, and coming back, extra buttons were created.
  Clicking on the wrong button would crash the IDE.

ecere/src/gui/controls/Stacker.ec

index 558d5d5..bfe9fb0 100644 (file)
@@ -430,7 +430,7 @@ private:
 
    public void DestroyChildren()
    {
-      // This is not required and will jam if the Stacker is destroyed
+      // This safe loop with 'left' will jam if the Stacker is destroyed
       if(!destroyed && created)
       {
          bool left = true;
@@ -448,6 +448,18 @@ private:
             }
          }
       }
+      else
+      {
+         // If the stacker is already destroyed, just clear everything
+         Iterator<Window> it { controls };
+         while(it.pointer = null, it.Next())
+         {
+            Window w = it.data;
+            it.Remove();
+            w.Destroy(0);
+            delete w;
+         }
+      }
    }
 
    public void MakeControlVisible(Window control)