X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Feditors%2FSimulationViewEditor.java;fp=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Feditors%2FSimulationViewEditor.java;h=12865a66ef0c0acbc4e8a2b3cc4a9f006a68c746;hb=64d813dd8fe6626af99bd23c312b0f85cfc46d36;hp=4dd346bda8bcc1f0d0912741b23a965351fb6c5d;hpb=894ae8a03d4ce70978078b74a33c71063ef05335;p=Mograsim.git 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 4dd346bd..12865a66 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 @@ -54,6 +54,7 @@ public class SimulationViewEditor extends EditorPart private Label noMachineLabel; private MemoryCellModifiedListener currentRegisteredCellListener; + private LogicObserver currentClockObserver; @Override public void createPartControl(Composite parent) @@ -88,7 +89,10 @@ public class SimulationViewEditor extends EditorPart simSpeedSlider.setEnabled(true); if (machine != null) + { machine.getMicroInstructionMemory().deregisterCellModifiedListener(currentRegisteredCellListener); + machine.getClock().deregisterObserver(currentClockObserver); + } machine = machineOptional.get(); canvas = new LogicUICanvas(parent, SWT.NONE, machine.getModel()); @@ -129,7 +133,7 @@ public class SimulationViewEditor extends EditorPart sbseButton = new Button(c, SWT.CHECK); pauseButton = new Button(c, SWT.TOGGLE); - LogicObserver clockObserver = o -> + currentClockObserver = o -> { if (((CoreClock) o).isOn()) { @@ -149,9 +153,9 @@ public class SimulationViewEditor extends EditorPart { CoreClock cl = machine.getClock(); if (sbseButton.getSelection()) - cl.registerObserver(clockObserver); + cl.registerObserver(currentClockObserver); else - cl.deregisterObserver(clockObserver); + cl.deregisterObserver(currentClockObserver); }); sbseButton.setSelection(false);