From 64d813dd8fe6626af99bd23c312b0f85cfc46d36 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 25 Sep 2019 12:42:07 +0200 Subject: [PATCH] SVE now supports context changes better (untested) --- .../mograsim/plugin/editors/SimulationViewEditor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 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); -- 2.17.1