From: Christian Femers Date: Thu, 26 Sep 2019 04:53:59 +0000 (+0200) Subject: Reordered the disposal of the old resources, because of errors X-Git-Url: https://mograsim.net/gitweb/?p=Mograsim.git;a=commitdiff_plain;h=c303ab90cb0fb61acde8a1e0ddc7a5ed8855ab82 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. --- 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())