Skip to content

Commit eb769c4

Browse files
committed
[Win32] Add double-dispose guard in DestroyableImageHandle.destroy()
The destroy() method did not check the isDisposed flag before calling OS.DestroyIcon/OS.DeleteObject. If called twice, it would pass an already-freed handle to the OS, risking undefined behavior. Add an early return when the handle is already disposed.
1 parent 1b54d33 commit eb769c4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3319,6 +3319,7 @@ public boolean isDisposed() {
33193319
}
33203320

33213321
void destroy() {
3322+
if (isDisposed) return;
33223323
if (type == SWT.ICON) {
33233324
OS.DestroyIcon (handle());
33243325
} else {

0 commit comments

Comments
 (0)