Commit 3913243
committed
Fix find/replace overlay asyncExecIfOpen running on disposed container
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.1 parent 132e20a commit 3913243
1 file changed
Lines changed: 1 addition & 1 deletion
File tree
- bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | | - | |
| 355 | + | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| |||
0 commit comments