Bug 573813 - non disposed widget error on first start
- Handle special case for 'TaskBar.createShellLink()' where Image object
doesn't own the handle
Change-Id: Id066037b5d1fc6892055f679efd02baa71e9788a
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/181184
Reviewed-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java
index 0ce7708..e0bc571 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 IBM Corporation and others.
+ * Copyright (c) 2010, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -167,6 +167,11 @@
if (item.hBitmap != 0) {
Image image2 = Image.win32_new (display, SWT.BITMAP, item.hBitmap);
data = image2.getImageData (DPIUtil.getDeviceZoom ());
+ /*
+ * image2 instance doesn't own the handle and shall not be disposed. Make it
+ * appear disposed to cause leak trackers to ignore it.
+ */
+ image2.handle = 0;
} else {
data = image.getImageData (DPIUtil.getDeviceZoom ());
}