From 5655cb9511a0e8d78b22502f054e4af9434b66e9 Mon Sep 17 00:00:00 2001
From: MarkusKrug <markus.krug@uni-wuerzburg.de>
Date: Tue, 7 Mar 2017 13:09:39 +0100
Subject: [PATCH] test to fix the disposal problem on linux systems

---
 .../kall/athen/widget/editor/AnnotationEditorWidget.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/widget/editor/AnnotationEditorWidget.java b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/widget/editor/AnnotationEditorWidget.java
index 2975ebef..717b7274 100644
--- a/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/widget/editor/AnnotationEditorWidget.java
+++ b/de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/widget/editor/AnnotationEditorWidget.java
@@ -126,6 +126,7 @@ public class AnnotationEditorWidget extends Composite {
 	private boolean preventPaintListenerPaint;
 	private Type activeModeType;
 	private Point pointOfLastPaint;
+	private Image blankBackground;
 
 	public AnnotationEditorWidget(Composite parent, int style) {
 		super(parent, style);
@@ -793,7 +794,10 @@ public class AnnotationEditorWidget extends Composite {
 		// set the background of the image to white so that we cannot see any
 		// relicts from previous iterations
 		Rectangle clientArea = widget.getClientArea();
-		Image blankBackground = new Image(Display.getCurrent(), clientArea);
+		if(blankBackground!=null){
+			blankBackground.dispose();
+		}
+		blankBackground = new Image(Display.getCurrent(), clientArea);
 		widget.setBackgroundImage(blankBackground);
 
 		// this method gets All Annotations that are visible atm
@@ -887,7 +891,7 @@ public class AnnotationEditorWidget extends Composite {
 		// widget.notifyListeners(SWT.Paint, event);
 		// event.gc.dispose();
 		
-		blankBackground.dispose();
+
 
 	}
 
-- 
GitLab