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; this.currentProject = project;
drawingManager.clearComponentAreaMap(); drawingManager.clearComponentAreaMap();
drawingManager.clearContinuityArea(); drawingManager.clearContinuityArea();
DrawingCache.Instance.clear();
updateSelection(EMPTY_SELECTION); updateSelection(EMPTY_SELECTION);
messageDispatcher.dispatchMessage(EventType.PROJECT_LOADED, project, freshStart, filename); messageDispatcher.dispatchMessage(EventType.PROJECT_LOADED, project, freshStart, filename);
messageDispatcher.dispatchMessage(EventType.REPAINT); messageDispatcher.dispatchMessage(EventType.REPAINT);
@@ -327,7 +328,6 @@ public class Presenter implements IPlugInPort {
instantiationManager.fillWithDefaultProperties(project, null); instantiationManager.fillWithDefaultProperties(project, null);
loadProject(project, true, null); loadProject(project, true, null);
projectFileManager.startNewFile(); projectFileManager.startNewFile();
DrawingCache.Instance.clear();
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not create new file", e); LOG.error("Could not create new file", e);
view.showMessage(ERROR_NEW, ERROR, IView.ERROR_MESSAGE); 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); view.showMessage(builder.toString(), WARNING, IView.WARNING_MESSAGE);
} }
addToRecentFiles(fileName); addToRecentFiles(fileName);
DrawingCache.Instance.clear();
} catch (Exception ex) { } catch (Exception ex) {
LOG.error("Could not load file", ex); LOG.error("Could not load file", ex);
String errorMessage = "Could not open file " + fileName + ". Check the log for details."; String errorMessage = "Could not open file " + fileName + ". Check the log for details.";
@@ -3530,6 +3530,10 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Slightly fancier splash screen :)</description> <description>Slightly fancier splash screen :)</description>
</org.diylc.appframework.update.Change> </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> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version> </org.diylc.appframework.update.Version>