Skip to content

[Win32] Add double-dispose guard in DestroyableImageHandle.destroy()#3243

Open
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare:fix-win32-image-double-dispose
Open

[Win32] Add double-dispose guard in DestroyableImageHandle.destroy()#3243
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare:fix-win32-image-double-dispose

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

Summary

  • Add an early-return guard in DestroyableImageHandle.destroy() to prevent passing an already-freed GDI handle to OS.DestroyIcon/OS.DeleteObject when destroy() is called more than once
  • The isDisposed flag was already being set at the end of destroy() but was not checked on entry

Test plan

  • Verify existing SWT Image tests still pass
  • Confirm no regressions in Image disposal on Win32

🤖 Generated with Claude Code

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.
@github-actions
Copy link
Copy Markdown
Contributor

Test Results (win32)

   30 files  ±0     30 suites  ±0   5m 21s ⏱️ +43s
4 675 tests ±0  4 602 ✅ ±0  73 💤 ±0  0 ❌ ±0 
1 209 runs  ±0  1 185 ✅ ±0  24 💤 ±0  0 ❌ ±0 

Results for commit 70cc597. ± Comparison against base commit 855fff4.

@HeikoKlare HeikoKlare marked this pull request as ready for review April 16, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant