| Summary: | Eclipse stops opening editors | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Kai-Uwe Maetzel <kai-uwe_maetzel> |
| Component: | UI | Assignee: | Michael Van Meekeren <michaelvanmeekeren> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | critical | ||
| Priority: | P2 | CC: | douglas.pollock, eclipse, sxenos |
| Version: | 3.0 | ||
| Target Milestone: | 3.0 RC3 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Kai-Uwe Maetzel
*** Bug 65046 has been marked as a duplicate of this bug. *** Adding the following isDisposed check in EditorPane.setFocus seems to stop
this from happening. Trying to find out why it was disposed.
public void setFocus() {
super.setFocus();
if (workbook.isDisposed()) {
return;
}
workbook.becomeActiveWorkbook(true);
}
The problem is that while the partActivated notification is being processed (triggered by DefaultPartPresentation$2.mouseDown), the editor is closed (triggered by PaneFolder$3.close(CTabFolderEvent)). The disposed editor workbook is then made the active one, in EditorStack.becomeActiveWorkbook, called from EditorPane.setFocus. The call to becomeActiveWorkbook from EditorPane.setFocus() was added as part of the fix for bug 62325. I'm not sure why this was needed, but I don't feel comfortable removing it without further investigation, or talking to Stephan first. The patch in comment #2 checks whether the workbook has been disposed before telling it to becomeActiveWorkbook, but I think that it would be better to maintain the following invariants further down in EditorSashContainer: - either activeEditorWorkbook is null, or it is a member of editorWorkbooks - editorWorkbooks contains only non-disposed workbooks The following patch to EditorSashContainer accomplishes this: Index: EditorSashContainer.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSashContainer.java,v retrieving revision 1.3 diff -u -r1.3 EditorSashContainer.java --- EditorSashContainer.java 12 May 2004 18:22:46 -0000 1.3 +++ EditorSashContainer.java 14 Jun 2004 19:16:15 -0000 @@ -298,6 +298,12 @@ * Set the editor workbook which is active. */ public void setActiveWorkbook(EditorStack newWorkbook, boolean hasFocus) { + if (newWorkbook != null) { + if (newWorkbook.isDisposed()) + return; + if (!editorWorkbooks.contains(newWorkbook)) + return; + } EditorStack oldWorkbook = activeEditorWorkbook; activeEditorWorkbook = newWorkbook; Patch reviewed with Michael and released. Marking as fixed. Verified I20040617 (0800). |