Bug 56287 - [Editor Mgmt] NPE closing editor not-in-focus
Summary: [Editor Mgmt] NPE closing editor not-in-focus
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P1 critical (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Chris McLaren CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-25 22:16 EST by DJ Houghton CLA
Modified: 2004-03-26 12:37 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2004-03-25 22:16:48 EST
build i0325:2030

- download build
- start Eclipse (with 2 editors previously open)
- click on the close X of the editor which isn't in focus
- editor doesn't close and you get the following NPE in the console



osgi> !SESSION Mar 25, 2004 22:08:25.710 ---------------------------------------
------
java.version=1.4.2
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -showlocation -vmargs -cp C:\eclipse\dev\i0325-2030\ecli
pse\startup.jar org.eclipse.core.launcher.Main
!ENTRY org.eclipse.ui 4 4 Mar 25, 2004 22:08:25.720
!MESSAGE Unhandled event loop exception
Unhandled event loop exception
Reason:
!ENTRY org.eclipse.ui 4 0 Mar 25, 2004 22:08:25.730
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
        at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:952
)
        at org.eclipse.ui.internal.EditorManager.saveEditor(EditorManager.java:9
95)
        at org.eclipse.ui.internal.WorkbenchPage.closeEditors2(WorkbenchPage.jav
a:990)
        at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:
883)
        at org.eclipse.ui.internal.EditorPane.doHide(EditorPane.java:97)
        at org.eclipse.ui.internal.EditorWorkbook.close(EditorWorkbook.java:235)

        at org.eclipse.ui.internal.EditorWorkbook$1.close(EditorWorkbook.java:10
8)
        at org.eclipse.ui.internal.presentations.BasicStackPresentation$6.close(
BasicStackPresentation.java:182)
        at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2012)
        at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:769)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2578)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2256)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1562)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1536)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.jav
a:257)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139)
        at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90
)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformAct
ivator.java:277)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:239)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:316)
        at org.eclipse.core.launcher.Main.run(Main.java:741)
        at org.eclipse.core.launcher.Main.main(Main.java:725)
java.lang.NullPointerException
Comment 1 DJ Houghton CLA 2004-03-25 22:19:48 EST
Note if I make the editor have focus and then put it in the background it can
close OK.
Comment 2 Nick Edgar CLA 2004-03-25 22:24:15 EST
Workaround is either to activate the editor first before closing, or to do a
File > Close All then reopen the editors as needed.

Apparently a problem with lazily recreated editors.
Comment 3 Nick Edgar CLA 2004-03-26 00:16:42 EST
Fixed by backing out original fix for bug 55905.
Comment 4 Nick Edgar CLA 2004-03-26 01:12:45 EST
This was caused by a later reference to a null IEditorPart (a lazy editor),
similar to the problem Kim raised in bug 55905 comment #5.
Comment 5 Ines Khelifi CLA 2004-03-26 12:37:29 EST
Verified on Windows XP with Build id: 200403260800.