redfx-quantum/strangefx

Renderer contains shared state

sponiro opened this issue · 2 comments

The class org.redfx.strangefx.render.Renderer contains a static variable myStage. When executing the example from https://github.com/johanvos/quantumjava and the class org.redfx.javaqc.ch05.cnot.Main the results displayed are not what was calculated.
I suspect the shared variable leads to multiple overrides of some displayed variables. The visible results might even change for each execution. Also, the barchart which is only visible for one window backs up this theory.
When I start only one part of the program like run10(); and comment the others the display is correct.

StrangeFX-1
StrangeFX-2
StrangeFX-3
StrangeFX-4

Thanks for the report. The myStage should be fine, but I realize that the endStates are now static:

ObservableList<Double> endStates = Model.getInstance().getEndStates();

I'll fix it, good catch!

Fixed by #61