Fixed a major memory leak when using Undo functionality

This commit is contained in:
bancika
2021-02-07 19:04:49 +01:00
parent c7a68d6542
commit 9617449de8
2 changed files with 6 additions and 3 deletions
@@ -312,6 +312,7 @@ public class Presenter implements IPlugInPort {
this.currentProject = project;
drawingManager.clearComponentAreaMap();
drawingManager.clearContinuityArea();
DrawingCache.Instance.clear();
updateSelection(EMPTY_SELECTION);
messageDispatcher.dispatchMessage(EventType.PROJECT_LOADED, project, freshStart, filename);
messageDispatcher.dispatchMessage(EventType.REPAINT);
@@ -326,8 +327,7 @@ public class Presenter implements IPlugInPort {
Project project = new Project();
instantiationManager.fillWithDefaultProperties(project, null);
loadProject(project, true, null);
projectFileManager.startNewFile();
DrawingCache.Instance.clear();
projectFileManager.startNewFile();
} catch (Exception e) {
LOG.error("Could not create new file", e);
view.showMessage(ERROR_NEW, ERROR, IView.ERROR_MESSAGE);
@@ -353,7 +353,6 @@ public class Presenter implements IPlugInPort {
view.showMessage(builder.toString(), WARNING, IView.WARNING_MESSAGE);
}
addToRecentFiles(fileName);
DrawingCache.Instance.clear();
} catch (Exception ex) {
LOG.error("Could not load file", ex);
String errorMessage = "Could not open file " + fileName + ". Check the log for details.";
@@ -3530,6 +3530,10 @@
<changeType>IMPROVEMENT</changeType>
<description>Slightly fancier splash screen :)</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Fixed a major memory leak when using Undo functionality</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>