Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314317

Summary: Cannot re-create a previously closed MWindow instance
Product: [Eclipse Project] e4 Reporter: Brian de Alwis <bsd>
Component: LanguagesAssignee: Project Inbox <e4.languages-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 1.0 RC0   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
patch to avoid NPE none

Description Brian de Alwis CLA 2010-05-25 13:53:47 EDT
BuildId: HEAD as of 2010/05/25

Executing the following code for a window that has previously been closed through the OS facilities leads to an NPE  in WBWRenderer#trackActivePart() (stacktrace below).

	@Inject @Optional IPresentationEngine engine;
	
	@Execute @Inject
	public MWindow open(MApplication app) {
		MWindow notesWindow = findWindow(app);
		assert notesWindow != null;
		notesWindow.setToBeRendered(true);
		notesWindow.setVisible(true);
		if(notesWindow.getRenderer() == null && engine != null) { 
			engine.createGui(notesWindow); 
		}
	}

The problem seems to be that one of the widgets is activated, leading to PartServiceImpl.activate(MPart) being called.  There is a codepath in trackActivePart that will NPE for parts that are not embedded in a part stack.


Daemon Thread [Thread-0] (Suspended (breakpoint at line 136 in WBWRenderer))	
	WBWRenderer.trackActivePart(MPart) line: 136	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	MethodRequestor.execute() line: 42	
	ContextObjectSupplier$ContextInjectionListener.update(IEclipseContext, int, Object[], IContextRecorder) line: 75	
	EclipseContext$TrackableComputationExt.update(ContextChangeEvent) line: 125	
	EclipseContext.processScheduled(List<Scheduled>) line: 438	
	EclipseContext.set(String, Object) line: 455	
>	PartServiceImpl.activate(MPart) line: 356	
	ContributedPartRenderer(AbstractPartRenderer).activate(MPart) line: 105	
	ContributedPartRenderer$1.handleEvent(Event) line: 74	
	EventTable.sendEvent(Event) line: 84	
	Display.sendEvent(EventTable, Event) line: 3764	
	Composite(Widget).sendEvent(Event) line: 1343	
	Composite(Widget).sendEvent(int, Event, boolean) line: 1366	
	Composite(Widget).sendEvent(int) line: 1347	
	Shell.setActiveControl(Control) line: 1355	
	Tree(Control).sendFocusEvent(int) line: 2948	
	Display.checkFocus() line: 618	
	Shell.makeFirstResponder(long, long, long) line: 1112	
	Display.windowProc(long, long, long) line: 5072	
	OS.objc_msgSendSuper(objc_super, long, long) line: not available [native method]	
	Shell(Widget).callSuperBoolean(long, long, long) line: 275	
	Shell(Widget).makeFirstResponder(long, long, long) line: 1074	
	Shell.makeFirstResponder(long, long, long) line: 1111	
	Display.windowProc(long, long, long) line: 5072	
	OS.objc_msgSendSuper(objc_super, long) line: not available [native method]	
	Tree(Widget).callSuperBoolean(long, long) line: 255	
	Tree(Widget).becomeFirstResponder(long, long) line: 320	
	Tree(Control).becomeFirstResponder(long, long) line: 638	
	Display.windowProc(long, long) line: 4832	
	OS.objc_msgSendSuper(objc_super, long, long) line: not available [native method]	
	Shell(Widget).callSuperBoolean(long, long, long) line: 275	
	Shell(Widget).makeFirstResponder(long, long, long) line: 1074	
	Shell.makeFirstResponder(long, long, long) line: 1111	
	Display.windowProc(long, long, long) line: 5072	
	OS.objc_msgSend(long, long, long) line: not available [native method]	
	SWTWindow(NSWindow).makeKeyAndOrderFront(id) line: 190	
	Shell.makeKeyAndOrderFront() line: 1130	
	Shell.setWindowVisible(boolean, boolean) line: 1740	
	Shell.open() line: 1173	
	WBWRenderer.postProcess(MUIElement) line: 504	
	PartRenderingEngine.createGui(MUIElement, Object) line: 328	
	PartRenderingEngine.createGui(MUIElement) line: 370	
	OpenNotesWindow.open(MApplication) line: 26
Comment 1 Brian de Alwis CLA 2010-05-25 13:55:27 EDT
Created attachment 169864 [details]
patch to avoid NPE
Comment 2 Eric Moffatt CLA 2010-05-25 14:01:33 EDT
Committed in >20100525. Applied Brian's patch...thanks !!