Skip to content

Commit cf17f0a

Browse files
committed
FindReplaceOverlay: avoid exception while closing workbench window #2666
When closing a workbench window while a find/replace overlay is open and one of the input fields (find/replace) has focus, an exception is thrown. This is caused by the FindReplaceOverlay trying to reactive shortcuts of the underlying editor while the input field is losing focus, but the handler service to perform the activation in is already disposed. Since there is no direct way of determining the underlying handler service from the overlay to identify whether it is already disposed, this change makes the overlay simply check for the workbench window currently being closed. This is reasonable as the reactivation of handlers is unnecessary if the underlying window is closed anyway. Fixes #2666
1 parent 58bb65c commit cf17f0a

File tree

1 file changed

+1
-1
lines changed
  • bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay

1 file changed

+1
-1
lines changed

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void focusLost(FocusEvent e) {
172172
* boolean)
173173
*/
174174
private void setTextEditorActionsActivated(boolean state) {
175-
if (!(targetPart instanceof AbstractTextEditor)) {
175+
if (!(targetPart instanceof AbstractTextEditor) || targetPart.getSite().getWorkbenchWindow().isClosing()) {
176176
return;
177177
}
178178
if (targetPart.getSite() instanceof MultiPageEditorSite multiEditorSite) {

0 commit comments

Comments
 (0)