bigdataviewer / bigdataviewer-core

ImgLib2-based viewer for registered SPIM stacks and more
BSD 2-Clause "Simplified" License
33 stars 35 forks source link

Bug in branch generic-renderer-revised #101

Closed StephanPreibisch closed 4 years ago

StephanPreibisch commented 4 years ago

Hi @tpietzsch,

I occasionally get this bug (I cannot reproduce it):

Exception in thread "PainterThread" java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:422) at java.util.ArrayList.get(ArrayList.java:435) at bdv.viewer.render.ScreenScales.get(ScreenScales.java:71) at bdv.viewer.render.MultiResolutionRenderer.paintFullFrame(MultiResolutionRenderer.java:440) at bdv.viewer.render.MultiResolutionRenderer.paint(MultiResolutionRenderer.java:422) at bdv.viewer.ViewerPanel.paint(ViewerPanel.java:474) at bdv.viewer.render.PainterThread.run(PainterThread.java:87)

Seems to be because requestedScreenScaleIndex == -1; An if would solve it, but I'm not sure why this happens ... so just adding the if doesn't look like the right thing to do.

Best, Stephan

tpietzsch commented 4 years ago

I managed to reproduce it by putting a Thread.sleep(1) at the start of MultiResolutionRenderer.paint(), and figure out why it happened: a repaint request sets newFrameRequest = true before the currently running paint() can clear it (which happens more or less first thing, which is why it almost never came up). The fix is actually an if :-)