Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358491 - NPE in MinMaxAddon.restore
Summary: NPE in MinMaxAddon.restore
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 362302 433742 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-21 16:48 EDT by John Arthorne CLA
Modified: 2019-02-02 10:27 EST (History)
5 users (show)

See Also:


Attachments
full stacktrace (4.80 KB, text/plain)
2013-07-12 20:03 EDT, Rafael Chaves CLA
no flags Details
NPE seen when trying to minimize a maximized editor (6.45 KB, text/plain)
2013-07-16 13:41 EDT, Rafael Chaves CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2011-09-21 16:48:55 EDT
I20110915-0200

I found this error in my log. I haven't been able to reproduce it.

!ENTRY org.eclipse.equinox.event 4 0 2011-09-21 16:17:04.397
!MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ApplicationElement/tags/REMOVE] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@30af7aff
!STACK 0
java.lang.NullPointerException
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.restore(MinMaxAddon.java:418)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon$5.handleEvent(MinMaxAddon.java:265)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4683)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:182)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
	at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:731)
	at org.eclipse.emf.common.util.AbstractEList.remove(AbstractEList.java:466)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.unzoom(MinMaxAddon.java:516)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon$5.handleEvent(MinMaxAddon.java:267)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4683)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:182)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
Comment 1 Michael Rennie CLA 2012-04-30 14:03:53 EDT
*** Bug 362302 has been marked as a duplicate of this bug. ***
Comment 2 Rafael Chaves CLA 2012-11-16 14:41:15 EST
Same here (M20120914-1800), on Linux, two entries at the same time.
Comment 3 Rafael Chaves CLA 2013-07-10 15:06:09 EDT
Got this again, with 4.3 now - not sure if cause or consequence, but got into that weird state where the editor area ends up becoming stuck in the minimized state and can no longer be restored. Restarting was the only way out (perspective resetting wouldn't do it).
Comment 4 Eric Moffatt CLA 2013-07-11 15:55:49 EDT
Rafael, can you describe the exact steps you performed to get into this state...I've been trying but without success...
Comment 5 Rafael Chaves CLA 2013-07-11 16:18:04 EDT
Eric, never found a reproducible test case, but somehow I am pretty good at getting the view management to go berzerk (maybe once a week?). 

One thing about my setup/workflow is that I use a laptop (no second monitor) and like to use the editors in maximized mode, so I am constantly opening minimized views, and often toggling views between fast view to normal.

That, and I am on Linux, if it matters.
Comment 6 Rafael Chaves CLA 2013-07-12 20:00:50 EDT
Just had it happen again. This time, I was just hitting Ctrl-F6 to switch editors. Suddenly the editors shared area became stuck in the minimized mode. 

After a lot of attempts to restore it, it finally became unstuck and the editors are now showing again. Will attach my stack trace, in case it helps.
Comment 7 Rafael Chaves CLA 2013-07-12 20:03:00 EDT
Created attachment 233448 [details]
full stacktrace
Comment 8 Rafael Chaves CLA 2013-07-14 17:03:51 EDT
If this is the offending code:

579		TrimStack ts = (TrimStack) trimStack.getObject();
580		ts.restoreStack();

it seems this issue is just a symptom, not a bug, and the real bug is whatever what allows the MContribution's object reference to become null. Can you think of a situation where that could happen? Is it a valid scenario? If not, can you add a check so that never happens silently?
Comment 9 Eric Moffatt CLA 2013-07-16 11:05:17 EDT
Rafael, for now I'm holding off on just plastering over the symptom just so we can hope to track down the real cause...

Thanks for the info on your workflow, it leads me to a couple of questions:

1) Do you ever minimize the currently maximized part / editor ? (without going through an intermediate restore)

2) From your comments about the minimized editor area being 'stuck' I'm guessing that you maximize views as well as the editor area correct ?
Comment 10 Rafael Chaves CLA 2013-07-16 12:52:16 EDT
Eric, my suggestion was not to hide the symptom, but to show the cause (by making it fail hard earlier, at the time the bad state is created, not later when we depend on the state - assuming that is possible). 

> 1) Do you ever minimize the currently maximized 
> part / editor ? (without going through an intermediate restore)

I may, I also use double-clicking on the editor title area a lot, for toggling between normal and maximized state. Funny thing, I went to try what you suggested (minimize a maximized editor) and the issue happened right away. I couldn't repeat it though. 

> 2) From your comments about the minimized editor area 
> being 'stuck' I'm guessing that you maximize views as well 
> as the editor area correct ?

I maximize views less often (console view, for instance).

Maybe unrelated/different bug, but as I tried the interactions suggested here I also got a minimized view stack to become 'unrestorable'. I can open individual views in quick view mode, but hitting the restore button on the stack toolbar does nothing.
Comment 11 Rafael Chaves CLA 2013-07-16 12:53:51 EDT
(BTW: that latest symptom I mentioned above happened on a new instance of the workbench, so it shouldn't be a side effect of the exception I reproduced earlier).
Comment 12 Eric Moffatt CLA 2013-07-16 13:18:40 EDT
Thanks again for the quick response. I'm not sure why this issue seems to be quite uncommon (we'd be getting flamed if it was...;-) but you seem to be able to induce it quite easily...maybe you're just really fast ?

Do you have animations turned on ? If so try turning them off...
Comment 13 Rafael Chaves CLA 2013-07-16 13:37:08 EDT
Nope, no animations. 

Theme: GTK
Animations: off
Comment 14 Rafael Chaves CLA 2013-07-16 13:41:23 EDT
Created attachment 233533 [details]
NPE seen when trying to minimize a maximized editor

Slightly different stack trace produced when trying to minimize a maximized editor.
Comment 15 Rafael Chaves CLA 2013-07-16 15:51:18 EDT
Realized now that I often maximize the console view from fast view mode (maximize editor, run app, peek at the console to take a look at the output, maximize if I want to see better).
Comment 16 Geraldine von Roten CLA 2013-07-23 05:37:33 EDT
I can see (and reproduce!) the same NPE when minimizing an empty PartStack. Same behaviour for my application on Kubuntu and Windows 7
Comment 17 Geraldine von Roten CLA 2013-07-23 05:46:44 EDT
Totally forgot to write: The eclipse version is Kepler
Comment 18 Eric Moffatt CLA 2013-07-23 14:13:22 EDT
Geraldine, the only empty part stack possible in the IDE is the one in an empty editor area, is this an e4 RCP issue perhaps ??
Comment 19 Geraldine von Roten CLA 2013-07-24 08:11:46 EDT
Sorry, yes, I don't have the problem in the IDE but in an RCP Application I/we are developing. Is this the wrong bug for that?
Comment 20 Paul Webster CLA 2014-04-29 12:13:50 EDT
*** Bug 433742 has been marked as a duplicate of this bug. ***
Comment 21 Lars Vogel CLA 2019-02-02 10:27:49 EST
Please reopen if problem still exists