From fcfa34a62fcc24dfd830dcac9c3327241041bf52 Mon Sep 17 00:00:00 2001 From: Nils Schmidt Date: Wed, 30 Aug 2017 20:30:11 +0200 Subject: [PATCH] Fixed issue #603. --- src/org/nschmidt/ldparteditor/widgets/BigDecimalSpinner.java | 4 ++-- src/org/nschmidt/ldparteditor/widgets/IntegerSpinner.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/nschmidt/ldparteditor/widgets/BigDecimalSpinner.java b/src/org/nschmidt/ldparteditor/widgets/BigDecimalSpinner.java index 125e04e8a..25e632b20 100644 --- a/src/org/nschmidt/ldparteditor/widgets/BigDecimalSpinner.java +++ b/src/org/nschmidt/ldparteditor/widgets/BigDecimalSpinner.java @@ -157,7 +157,7 @@ public void mouseScrolled(MouseEvent e) { selectAll = false; new Thread( () -> { focus = true; - while (focus) { + while (focus && !txt_val[0].isDisposed()) { try { Thread.sleep(100); } catch (InterruptedException ie) {} @@ -234,7 +234,7 @@ public void modifyText(ModifyEvent e) { new Thread(() -> { final int id = counter.getAndIncrement() + 1; focus = true; - while (focus && counter.compareAndSet(id, id) && !forceUpdate) { + while (focus && counter.compareAndSet(id, id) && !forceUpdate && !txt_val[0].isDisposed()) { Display.getDefault().asyncExec(() -> { try { focus = txt_val[0].isFocusControl(); diff --git a/src/org/nschmidt/ldparteditor/widgets/IntegerSpinner.java b/src/org/nschmidt/ldparteditor/widgets/IntegerSpinner.java index 3ea1d278c..547a2673f 100644 --- a/src/org/nschmidt/ldparteditor/widgets/IntegerSpinner.java +++ b/src/org/nschmidt/ldparteditor/widgets/IntegerSpinner.java @@ -139,7 +139,7 @@ public void mouseScrolled(MouseEvent e) { selectAll = false; new Thread( () -> { focus = true; - while (focus) { + while (focus && !txt_val[0].isDisposed()) { try { Thread.sleep(100); } catch (InterruptedException ie) {} @@ -197,7 +197,7 @@ public void modifyText(ModifyEvent e) { new Thread( () -> { final int id = counter.getAndIncrement() + 1; focus = true; - while (focus && counter.compareAndSet(id, id) && !forceUpdate) { + while (focus && counter.compareAndSet(id, id) && !forceUpdate && !txt_val[0].isDisposed()) { Display.getDefault().asyncExec(() -> { try { focus = txt_val[0].isFocusControl();