Fixed annoying sporadic crashes
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 30 Sep 2019 16:32:16 +0000 (18:32 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 30 Sep 2019 16:35:28 +0000 (18:35 +0200)
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicUICanvas.java

index 162e002..34cfb09 100644 (file)
@@ -53,7 +53,11 @@ public class LogicUICanvas extends ZoomableCanvas
                                setBackground(background);// this.setBackground, not gc.setBackground to have the background fill the canvas
                        renderer.render(gc, new Rectangle(-offX / zoom, -offY / zoom, gW / zoom, gH / zoom));
                });
-               model.setRedrawHandler(this::redrawThreadsafe);
+               model.setRedrawHandler(() ->
+               {
+                       if (!isDisposed())
+                               redrawThreadsafe();
+               });
 
                addListener(SWT.MouseDown, this::mouseDown);