From c303ab90cb0fb61acde8a1e0ddc7a5ed8855ab82 Mon Sep 17 00:00:00 2001 From: Christian Femers Date: Thu, 26 Sep 2019 06:53:59 +0200 Subject: [PATCH] Reordered the disposal of the old resources, because of errors Apparently this was able to lead to "widget disposed" exceptions, and for some reason the old canvas sill stays at it's place, causing two canvases side by side. --- .../plugin/editors/SimulationViewEditor.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/editors/SimulationViewEditor.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/editors/SimulationViewEditor.java index 2dcbaff3..0420334f 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/editors/SimulationViewEditor.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/editors/SimulationViewEditor.java @@ -85,6 +85,13 @@ public class SimulationViewEditor extends EditorPart double offX; double offY; double zoom; + if (exec != null) + exec.stopLiveExecution(); + if (machine != null) + { + machine.getMicroInstructionMemory().deregisterCellModifiedListener(currentRegisteredCellListener); + machine.getClock().deregisterObserver(currentClockObserver); + } if (canvas != null) { offX = canvas.getOffX(); @@ -97,14 +104,6 @@ public class SimulationViewEditor extends EditorPart offY = 0; zoom = -1; } - if (exec != null) - exec.stopLiveExecution(); - - if (machine != null) - { - machine.getMicroInstructionMemory().deregisterCellModifiedListener(currentRegisteredCellListener); - machine.getClock().deregisterObserver(currentClockObserver); - } Optional machineOptional; if (context != null && (machineOptional = context.getActiveMachine()).isPresent()) -- 2.17.1