ecere/gui/Window: Fixed leaks when switching mode in GuiApplication::Init()
authorJerome St-Louis <jerome@ecere.com>
Fri, 11 Apr 2014 06:53:06 +0000 (02:53 -0400)
committerJerome St-Louis <jerome@ecere.com>
Fri, 11 Apr 2014 06:53:06 +0000 (02:53 -0400)
- A complex pathway implicating the ToolTip class was causing memory leaks when the IDE was switched to OpenGL mode
  A 'display' was being assigned to the uncreated windows.

ecere/src/gui/Window.ec
ide/src/ide.ec

index 72d9dd3..c7e17c0 100644 (file)
@@ -8038,7 +8038,8 @@ public:
 
                   if(reloadGraphics)
                      UnloadGraphics(false);
-                  SetupDisplay();
+                  if(created)
+                     SetupDisplay();
                   if(reloadGraphics)
                      LoadGraphics(false, false);
 
index 1ff6b9a..e88975a 100644 (file)
@@ -195,7 +195,7 @@ void DrawLineMarginIcon(Surface surface, BitmapResource resource, int line, int
 
 class IDEToolbar : ToolBar
 {
-   /* File options */
+   // File options
    // New
    ToolButton buttonNewFile { this, toolTip = $"New file", menuItemPtr = IDEItem(fileNewItem) };
    // Open
@@ -209,7 +209,7 @@ class IDEToolbar : ToolBar
 
    ToolSeparator separator1 { this };
 
-   /* Edit options */
+   // Edit options
    // Cut
    // Copy
    // Paste
@@ -218,7 +218,7 @@ class IDEToolbar : ToolBar
 
    // ToolSeparator separator2 { this };
 
-   /* Project  options */
+   // Project options
    // New project
    ToolButton buttonNewProject { this, toolTip = $"New project", menuItemPtr = IDEItem(projectNewItem) };
    // Open project
@@ -230,7 +230,7 @@ class IDEToolbar : ToolBar
 
    ToolSeparator separator3 { this };
 
-   /* Build/Execution options */
+   // Build/Execution options
    // Build
    ToolButton buttonBuild { this, toolTip = $"Build project", menuItemPtr = IDEItem(projectBuildItem), disabled = true; };
    // Re-link
@@ -252,7 +252,7 @@ class IDEToolbar : ToolBar
 
    ToolSeparator separator4 { this };
 
-   /* Debug options */
+   // Debug options
    // Start/Resume
    ToolButton buttonDebugStartResume { this, toolTip = $"Start", menuItemPtr = IDEItem(debugStartResumeItem), disabled = true; };
    // Restart
@@ -344,7 +344,6 @@ class IDEToolbar : ToolBar
       activeBitDepth.AddString("64 bit").tag = 64;
       activeBitDepth.currentRow = row;
    }
-
 }
 
 class IDEMainFrame : Window
@@ -3680,11 +3679,14 @@ class IDEApp : GuiApplication
       }
       else
       {
+         app.driver = "OpenGL";
+/*
 #if defined(__unix__) || defined(__APPLE__)
          app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "X";
 #else
          app.driver = (ideSettings.displayDriver && !strcmp(ideSettings.displayDriver, "OpenGL")) ? ideSettings.displayDriver : "GDI";
 #endif
+*/
          ide.driverItems[ideSettings.displayDriver && !strcmp(ideSettings.displayDriver,"OpenGL")].checked = true;
       }
 
@@ -3853,6 +3855,8 @@ class IDEApp : GuiApplication
          };
       }
 
+      // ideMainFrame.toolBar.autoCreate = false;
+
       ideMainFrame.Create();
       if(app.argFilesCount > 1)
          ide.MenuWindowTileVert(null, 0);