Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349076 - NPE thrown when trying to close parts after merging detached stacks
Summary: NPE thrown when trying to close parts after merging detached stacks
Status: VERIFIED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 4.1 RC4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-10 12:55 EDT by Remy Suen CLA
Modified: 2011-06-14 15:35 EDT (History)
2 users (show)

See Also:
emoffatt: pmc_approved?
remy.suen: review+


Attachments
Patch to reparent the context of the elements as they get inserted into the new stack (2.22 KB, patch)
2011-06-10 13:35 EDT, Eric Moffatt CLA
no flags Details | Diff
New patch that fixes the PartRenderingEngine's context handling (983 bytes, patch)
2011-06-10 14:12 EDT, Eric Moffatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-06-10 12:55:02 EDT
1. Activate the 'Javadoc' view.
2. Activate the 'Declaration' view.
3. Detach the bottom stack.
4. Detach the left stack.
5. Now drag the bottom stack's stack to merge with the detached window with the left stack in it.
6. The 'Declaration' view should be the one on top. Try to close the 'Javadoc' view. An NPE will be thrown.

java.lang.NullPointerException
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart(StackRenderer.java:663)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.access$6(StackRenderer.java:649)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$6.close(StackRenderer.java:616)
	at org.eclipse.e4.ui.widgets.CTabFolder.onMouse(CTabFolder.java:1787)
Comment 1 Eric Moffatt CLA 2011-06-10 13:35:43 EDT
Created attachment 197804 [details]
Patch to reparent the context of the elements as they get inserted into the new stack
Comment 2 Eric Moffatt CLA 2011-06-10 13:36:32 EDT
I've tried to make the patch as safe as possible just in case...
Comment 3 Remy Suen CLA 2011-06-10 13:46:16 EDT
(In reply to comment #1)
> Created attachment 197804 [details]
> Patch to reparent the context of the elements as they get inserted into the new
> stack

I am not sure if the problem is in the DND dropping. Someone could use the model APIs to move the placeholders around and they would expect their parts' contexts to be reparented. I think there is something off in the rendering engine itself?
Comment 4 Eric Moffatt CLA 2011-06-10 14:12:13 EDT
Created attachment 197805 [details]
New patch that fixes the PartRenderingEngine's context handling


The 'parent' check was incorrectly skipping MPlaceholders for which createGui was being called directly.
Comment 5 Remy Suen CLA 2011-06-10 14:50:31 EDT
(In reply to comment #4)
> Created attachment 197805 [details]
> New patch that fixes the PartRenderingEngine's context handling

I can confirm that the problem goes away with this patch. There are still cases where complicated structures will fail to have their child structures' contexts reparented properly.

Please open a new bug for the creation of a test for the scenario described by comment 1.
Comment 6 Eric Moffatt CLA 2011-06-10 14:58:32 EDT
I've opened Bug 349085 to track the necessity for creating a test for this...

The more complex scenarios I've opened Bug 349086.
Comment 7 Eric Moffatt CLA 2011-06-10 15:01:44 EDT
Mike, another one for you...
Comment 8 Eric Moffatt CLA 2011-06-10 15:31:41 EDT
Committed in >20110610. Applied the patch.
Comment 9 Eric Moffatt CLA 2011-06-10 15:34:01 EDT
Setting milestone...
Comment 10 Eric Moffatt CLA 2011-06-14 15:35:18 EDT
Verified in I20110613-2055.