Fixed annoying sporadic crashes
[Mograsim.git] / 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);