From 338bb67b0fe291f56f31d69f11ea1a45ed7cfeb6 Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Tue, 25 Jun 2019 07:22:44 -0700 Subject: [PATCH] Don't try to dispose the clipboard if the display is already disposed. This avoids error during shutdown. --- gapic/src/main/com/google/gapid/widgets/CopyPaste.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gapic/src/main/com/google/gapid/widgets/CopyPaste.java b/gapic/src/main/com/google/gapid/widgets/CopyPaste.java index 58aac00b49..e0f539f2ec 100644 --- a/gapic/src/main/com/google/gapid/widgets/CopyPaste.java +++ b/gapic/src/main/com/google/gapid/widgets/CopyPaste.java @@ -48,9 +48,11 @@ public CopyPaste(Display display) { } public void dispose() { - display.removeFilter(SWT.FocusIn, focusListener); - display.removeFilter(SWT.FocusOut, focusListener); - clipboard.dispose(); + if (!display.isDisposed()) { + display.removeFilter(SWT.FocusIn, focusListener); + display.removeFilter(SWT.FocusOut, focusListener); + clipboard.dispose(); + } } public void registerCopySource(Control focusReceiver, CopySource source) {