From d85de44b42286f05fc60ebcea60f16d24337f34e Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Fri, 11 Apr 2014 02:53:06 -0400 Subject: [PATCH] ecere/gui/Window: Fixed leaks when switching mode in GuiApplication::Init() - 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 | 3 ++- ide/src/ide.ec | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ecere/src/gui/Window.ec b/ecere/src/gui/Window.ec index 72d9dd3..c7e17c0 100644 --- a/ecere/src/gui/Window.ec +++ b/ecere/src/gui/Window.ec @@ -8038,7 +8038,8 @@ public: if(reloadGraphics) UnloadGraphics(false); - SetupDisplay(); + if(created) + SetupDisplay(); if(reloadGraphics) LoadGraphics(false, false); diff --git a/ide/src/ide.ec b/ide/src/ide.ec index 1ff6b9a..e88975a 100644 --- a/ide/src/ide.ec +++ b/ide/src/ide.ec @@ -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); -- 1.8.3.1