Skip to content

Commit 9e5a09c

Browse files
committed
destroy tempHandle after usage
1 parent 4793787 commit 9e5a09c

File tree

1 file changed

+7
-2
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+7
-2
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,14 @@ public static long win32_getHandle (Image image, int zoom) {
818818
*/
819819
public void drawOnGCAtTargetSize(Consumer<Long> drawFunction, int targetWidth, int targetHeight) {
820820
ImageData imageData = this.imageProvider.newImageData(targetWidth, targetHeight);
821-
long tempHandle = init(device, imageData).handles()[0];
821+
HandleForImageDataContainer handleContainer = init(device, imageData);
822+
long tempHandle = handleContainer.handles()[0];
822823
drawFunction.accept(tempHandle);
823-
//Handle aufräumen
824+
if (handleContainer.type == SWT.ICON) {
825+
OS.DestroyIcon (tempHandle);
826+
} else {
827+
OS.DeleteObject (tempHandle);
828+
}
824829
}
825830

826831
/**

0 commit comments

Comments
 (0)