Bug 110354 - [WorkbenchParts] NPE dragging view from fast view bar.
Summary: [WorkbenchParts] NPE dragging view from fast view bar.
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P2 critical (vote)
Target Milestone: 3.1.1   Edit
Assignee: Paul Webster CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 110761 111682 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-22 14:26 EDT by Michael Van Meekeren CLA Friend
Modified: 2011-01-10 15:24 EST (History)
6 users (show)

See Also:


Attachments
fast view bug project (110.12 KB, application/zip)
2010-02-02 04:15 EST, Erdal Karaca CLA Friend
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Van Meekeren CLA Friend 2005-09-22 14:26:53 EDT
I get the following NPE after doing these steps:

- open the Java perspective
- make a view a fastview
- start dragging it, try to drop it on the bottom of the window so it takes the
full width of the window.
- NPE

Looks related to the changes for standalone views, this part may not have a
stack.  We should check all other callers of this once we find the NPE.


!ENTRY org.eclipse.ui 4 0 2005-09-22 14:09:47.664
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
        at org.eclipse.ui.internal.PartSashContainer.drag(PartSashContainer.java
:1034)
        at org.eclipse.ui.internal.dnd.DragUtil.getDropTarget(DragUtil.java:338)

        at org.eclipse.ui.internal.dnd.DragUtil.getDropTarget(DragUtil.java:361)

        at org.eclipse.ui.internal.dnd.DragUtil$2.run(DragUtil.java:217)
        at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:152)
        at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:2
8)
        at org.eclipse.swt.widgets.Display.syncExec(Display.java:3527)
        at org.eclipse.ui.internal.dnd.DragUtil$1.handleEvent(DragUtil.java:211)

        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:884)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:908)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:893)
        at org.eclipse.swt.widgets.Tracker.wmMouse(Tracker.java:1030)
        at org.eclipse.swt.widgets.Tracker.open(Tracker.java:509)
        at org.eclipse.ui.internal.dnd.DragUtil.dragToTarget(DragUtil.java:292)
        at org.eclipse.ui.internal.dnd.DragUtil.performDrag(DragUtil.java:124)
        at org.eclipse.ui.internal.FastViewBar.startDrag(FastViewBar.java:551)
        at org.eclipse.ui.internal.FastViewBar.startDraggingFastView(FastViewBar
.java:527)
        at org.eclipse.ui.internal.FastViewBar$1.handleEvent(FastViewBar.java:10
6)
        at org.eclipse.ui.presentations.PresentationUtil.handleMouseMove(Present
ationUtil.java:96)
        at org.eclipse.ui.presentations.PresentationUtil.access$4(PresentationUt
il.java:89)
        at org.eclipse.ui.presentations.PresentationUtil$2.handleEvent(Presentat
ionUtil.java:61)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:884)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3194)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2823)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1755)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1719)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.jav
a:368)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
        at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:10
6)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformAct
ivator.java:226)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:377)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:164)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:85)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:58)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:60)
        at java.lang.reflect.Method.invoke(Method.java:391)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
        at org.eclipse.core.launcher.Main.run(Main.java:977)
        at org.eclipse.core.launcher.Main.main(Main.java:952)
Comment 1 Paul Webster CLA Friend 2005-09-22 14:50:37 EDT
I added 2 calls to PartPane#getStack() and didn't check for null.

PW
Comment 2 Michael Van Meekeren CLA Friend 2005-09-26 16:23:32 EDT
This needs to be fixed for 3.1.1.  It causes Linux to leave the mouse cursor as
a drag cursor and the drag does not end.  Requires killing the X Server.
Comment 3 Paul Webster CLA Friend 2005-09-27 08:06:19 EDT
Released for 3.1.1 >20050927.

PW
Comment 4 Paul Webster CLA Friend 2005-09-27 09:05:03 EDT
Released to HEAD >20050927

PW
Comment 5 Eric Moffatt CLA Friend 2005-09-28 08:56:01 EDT
*** Bug 110761 has been marked as a duplicate of this bug. ***
Comment 6 Paul Webster CLA Friend 2005-09-28 14:59:49 EDT
Verified in M20050928-1055.
PW
Comment 7 Eric Moffatt CLA Friend 2005-10-06 14:35:25 EDT
*** Bug 111682 has been marked as a duplicate of this bug. ***
Comment 8 Erdal Karaca CLA Friend 2010-02-01 05:58:58 EST
I am getting a NPE in a similar case which seems to be introduced in 3.6M4 (3.5 works fine).

I debugged a little bit and this could be a hint:

In org.eclipse.ui.internal.FastViewPane.hideView():
[...]

        // Hide it completely.
        getPresentation().setVisible(false);
        site.dispose();
        //currentPane.setFastViewSash(null);
        ctrl.setEnabled(false); // Remove focus support.

        currentPane.dispose();
        currentPane = null;

The call to getPresentation().setVisible(false) causes hideView to be called twice. The first time, everything goes fine, but the second time, currentPane is null and currentPane.dispose() will raise a NPE.
Comment 9 Erdal Karaca CLA Friend 2010-02-01 06:02:48 EST
This is the stack trace:

java.lang.NullPointerException
at org.eclipse.ui.internal.FastViewPane.hideView(FastViewPane.java:582)
at org.eclipse.ui.internal.Perspective.hideFastView(Perspective.java:571)
at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1933)
at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1952)
at org.eclipse.ui.internal.Perspective.toggleFastView(Perspective.java:2355)
at org.eclipse.ui.internal.WorkbenchPage.toggleFastView(WorkbenchPage.java:3873)
at org.eclipse.ui.internal.WorkbenchPage.hideFastView(WorkbenchPage.java:3861)
at org.eclipse.ui.internal.FastViewPane$2.setState(FastViewPane.java:95)
at org.eclipse.ui.internal.FastViewPane$3.handleEvent(FastViewPane.java:306)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1240)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1049)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3524)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2407)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2371)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
at org.eclipse.equinox.launcher.Main.main(Main.java:1339)
Comment 10 Erdal Karaca CLA Friend 2010-02-02 04:15:44 EST
Created attachment 157881 [details]
fast view bug project

I have just run the mail demo and made the message view available as a fast view in the fast view bar: it cannot be moved due to this NPE.

Just import the the project and run the INCLUDED launch as this will use the workbench ide.
Comment 11 Erdal Karaca CLA Friend 2010-02-02 04:22:26 EST
Just downloaded 3.6M5 and imported the attached project and run the included launch config: bug persists.
Comment 12 Remy Suen CLA Friend 2010-02-02 06:41:05 EST
Paul, since the stack trace is different, I guess maybe we should open a new bug instead of reopening this one?
Comment 13 Paul Webster CLA Friend 2010-02-02 10:31:10 EST
(In reply to comment #12)
> Paul, since the stack trace is different, I guess maybe we should open a new
> bug instead of reopening this one?

Yes, there have been changes in this code, please open a new bug.

PW
Comment 14 Beyhan Veliev CLA Friend 2010-08-31 07:49:01 EDT
I can also reproduce this bug in the final release of 3.6. Just try to drug a visible fast view. Is there a new bug for this? I couldn't find.
Comment 15 Erdal Karaca CLA Friend 2010-08-31 08:21:53 EDT
Check if (and make sure that) the view's setFocus method sets the focus to a control that is in your view... at least, leaving setFocus empty will lead to this bug in 3.6...
Comment 16 celeraman + CLA Friend 2011-01-10 13:40:30 EST
+1 for reopen.

Tested in Eclipse 3.6.1.
When setFocus() view's method is empty and after doing these steps:

1. Open Show View Dialog.
2. Open a View with a setFocus() method that is empty.
3. Try to drag it and it will "disappear".because of the NPE.

The stack trace is:

!ENTRY org.eclipse.ui 4 0 2011-01-10 15:39:59.769
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.FastViewPane.hideView(FastViewPane.java:582)
	at org.eclipse.ui.internal.Perspective.hideFastView(Perspective.java:571)
	at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1933)
	at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1952)
	at org.eclipse.ui.internal.Perspective.toggleFastView(Perspective.java:2365)
	at org.eclipse.ui.internal.WorkbenchPage.toggleFastView(WorkbenchPage.java:3873)
	at org.eclipse.ui.internal.WorkbenchPage.hideFastView(WorkbenchPage.java:3861)
	at org.eclipse.ui.internal.FastViewPane$2.dragStart(FastViewPane.java:156)
	at org.eclipse.ui.internal.FastViewPane$2.dragStart(FastViewPane.java:136)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:118)
	at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:269)
	at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:282)
	at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.handleDragStarted(AbstractTabFolder.java:366)
	at org.eclipse.ui.internal.presentations.util.AbstractTabFolder$2.handleEvent(AbstractTabFolder.java:67)
	at org.eclipse.ui.presentations.PresentationUtil.handleMouseMove(PresentationUtil.java:110)
	at org.eclipse.ui.presentations.PresentationUtil.access$4(PresentationUtil.java:95)
	at org.eclipse.ui.presentations.PresentationUtil$2.handleEvent(PresentationUtil.java:63)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at net.sf.rcpforms.example.moons.core.Application.start(Application.java:20)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 17 Remy Suen CLA Friend 2011-01-10 13:45:52 EST
(In reply to comment #16)
> +1 for reopen.
> 
> Tested in Eclipse 3.6.1.
> When setFocus() view's method is empty and after doing these steps:
> 
> 1. Open Show View Dialog.
> 2. Open a View with a setFocus() method that is empty.

Clients are expected to assign focus to one of its controls. Leaving this blank is going against the API.
Comment 18 Paul Webster CLA Friend 2011-01-10 13:57:05 EST
(In reply to comment #16)
> +1 for reopen.

Different bug ... if this is a problem please open a new bug (as I mentioned).

PW
Comment 19 celeraman + CLA Friend 2011-01-10 15:24:31 EST
(In reply to comment #17)
> Clients are expected to assign focus to one of its controls. Leaving this blank
> is going against the API.

This makes sense! Thank you for the information!