Skip to content

Fix find/replace overlay asyncExecIfOpen running on disposed container#3999

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:fix/asyncExecIfOpen-disposed-container-check
May 30, 2026
Merged

Fix find/replace overlay asyncExecIfOpen running on disposed container#3999
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:fix/asyncExecIfOpen-disposed-container-check

Conversation

@HeikoKlare

@HeikoKlare HeikoKlare commented May 14, 2026

Copy link
Copy Markdown
Contributor

The inner guard in the find/replace overlay's asyncExecIfOpen used || instead of && and was missing the ! negation on isDisposed(). Since containerControl is never null, the condition always short-circuited to true, making the guard ineffective. This allowed updatePlacementAndVisibility to run on a disposed container, causing an SWTException: Widget is disposed.
This change fixes the condition so the operation only runs when the container is still alive.

@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Test Results

   864 files  ±0     864 suites  ±0   54m 45s ⏱️ + 2m 18s
 7 988 tests ±0   7 745 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 418 runs  ±0  19 763 ✅ ±0  655 💤 ±0  0 ❌ ±0 

Results for commit d6aebb7. ± Comparison against base commit 53e3e92.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the fix/asyncExecIfOpen-disposed-container-check branch from c394058 to aeca635 Compare May 14, 2026 07:47
The inner guard inside the asyncExec callback of the find/replace
overlay's asyncExecIfOpen method used || instead of && and was missing
the negation on isDisposed(). Because containerControl is an instance
field set once at construction and never cleared, the sub-expression
`containerControl != null` is unconditionally true. Combined with ||
this caused the entire condition to always short-circuit to true, making
the isDisposed() branch dead code and the guard ineffective.

As a result, the async callback could invoke operation.run() even after
containerControl had been disposed in the window between the outer check
and the callback executing. The sole caller passes
FindReplaceOverlay::updatePlacementAndVisibility, which calls
requestLayout(), setSize(), setLocation() and layout() directly on
containerControl. Executing those calls on a disposed widget throws an
SWTException ("Widget is disposed").

Fix by changing the condition to `containerControl != null &&
!containerControl.isDisposed()`, which correctly re-checks liveness
before running the operation.
@HeikoKlare HeikoKlare force-pushed the fix/asyncExecIfOpen-disposed-container-check branch from aeca635 to d6aebb7 Compare May 30, 2026 08:31
@HeikoKlare HeikoKlare merged commit 3913243 into eclipse-platform:master May 30, 2026
18 checks passed
@HeikoKlare HeikoKlare deleted the fix/asyncExecIfOpen-disposed-container-check branch May 30, 2026 09:16
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.

2 participants