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

Bug 163087

Summary: NPE if open a dialog when insert an item from palette
Product: [Tools] GEF Reporter: Masaki Wakao <wakao>
Component: GEF-Legacy GEF (MVC)Assignee: Brendan Curran-Johnson <brendanc>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse
Version: 3.2   
Target Milestone: 3.5.0 (Galileo) M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Masaki Wakao CLA 2006-11-01 11:09:51 EST
NPE occurs if a dialog is opened when user clicks an item on the palette and clicks again on the edit area near the border of the edit area.

You can reproduce with Shape example with the following patch:

Change ShapeCreateCommand#execute() 

public void execute() {
	TitleAreaDialog d = new TitleAreaDialog(Display.getCurrent().getActiveShell());
	d.open();
	newShape.setLocation(bounds.getLocation());
	Dimension size = bounds.getSize();
	if (size.width > 0 && size.height > 0)
		newShape.setSize(size);
	redo();
}
Comment 1 Masaki Wakao CLA 2006-11-01 11:19:27 EST
Actually NPE occurs at TargetingTool#updateTargetUnderMouse. Current view is null.
 
Because TargetingTool.QueuedAutoexpose which calls above method is activated by asyncExec, AbstractTool#viewerExit() is called before TargetingTool#updateTargetUnderMouse() is called. AbstractTool#viewerExit() sets null for currentViewer, so the NPE occurs.
Comment 2 Anthony Hunter CLA 2009-01-30 10:48:57 EST
Brendan, can you test with the Shapes example? I suspect this is fixed by Bug 133385
	

Comment 3 Brendan Curran-Johnson CLA 2009-02-06 10:34:26 EST
You are correct, this seems to have been fixed with Bug 133385. I couldn't reproduce the bug.