Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Null pointer on workbench close
Null pointer on workbench close [message #331302] Fri, 29 August 2008 12:44
Pierre Padovani is currently offline Pierre PadovaniFriend
Messages: 6
Registered: July 2009
Junior Member
This is a multipart message in MIME format.
--=_alternative 004600F3862574B4_=
Content-Type: text/plain; charset="US-ASCII"

All,
I followed the EMF/GMF editor integration example, and have run across
an odd shutdown issue under Eclipse 3.4. If I leave my editor open and
exit the workbench, I get a null pointer exception on line 869 of the
WorkbenchMenuService:

/*
* (non-Javadoc)
*
* @see
org.eclipse.ui.internal.menus.IMenuService#releaseMenu(org.e clipse.jface.action.ContributionManager)
*/
public void releaseContributions(ContributionManager mgr) {
// Recursive remove any contributions from sub-menus
---->>> IContributionItem[] items = mgr.getItems();
for (int i = 0; i < items.length; i++) {
if (items[i] instanceof ContributionManager) {
releaseContributions((ContributionManager)
items[i]);
} else if (items[i] instanceof
IToolBarContributionItem) {
IToolBarContributionItem tbci =
(IToolBarContributionItem) items[i];
releaseContributions((ContributionManager)
tbci
.getToolBarManager());
}
}

// Now remove any cached information
ManagerPopulationRecord mpr = (ManagerPopulationRecord)
populatedManagers.remove(mgr);
if (mpr != null)
mpr.releaseContributions();
managersAwaitingUpdates.remove(mgr);
}

Obviously the passed in ContributionManager is null. I've tested the
existing topicmap (EMF/GMF example code) and it behaves the same way.

One other data point. If I manually close the editor first, then I don't
see this problem. My editor's dispose() method is being called in both
cases.


Thoughts? Ideas?

Thanks!

Pierre


--=_alternative 004600F3862574B4_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">All,</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp;I followed the EMF/GMF
editor integration example, and have run across an odd shutdown issue under
Eclipse 3.4. If I leave my editor open and exit the workbench, I get a
null pointer exception on line 869 of the WorkbenchMenuService:</font>
<br>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#3f8080 face="Courier New">/*</font>
<br><font size=2 color=#3f8080 face="Courier New">&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;* (non-Javadoc)</font>
<br><font size=2 color=#3f8080 face="Courier New">&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;* </font>
<br><font size=2 color=#3f8080 face="Courier New">&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;* @see org.eclipse.ui.internal.menus.IMenuService#releaseMenu(org.e clipse.jface.action.ContributionManager) </font>
<br><font size=2 color=#3f8080 face="Courier New">&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;*/</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>void</b></font><font size=2 face="Courier New">
releaseContributions(ContributionManager mgr) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#3f8080 face="Courier New">//
Recursive remove any contributions from sub-menus</font>
<br><font size=2 face="Courier New">----&gt;&gt;&gt; &nbsp; &nbsp; &nbsp;
&nbsp;IContributionItem[] items = mgr.getItems();</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>for</b></font><font size=2 face="Courier New">
(</font><font size=2 color=#820040 face="Courier New"><b>int</b></font><font size=2 face="Courier New">
i = 0; i &lt; items.length; i++) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>if</b></font><font size=2 face="Courier New">
(items[i] </font><font size=2 color=#820040 face="Courier New"><b>instanceof</b></font><font size=2 face="Courier New">
ContributionManager) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; releaseContributions((ContributionManager)
items[i]);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } </font><font size=2 color=#820040 face="Courier New"><b>else</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>if</b></font><font size=2 face="Courier New">
(items[i] </font><font size=2 color=#820040 face="Courier New"><b>instanceof</b></font><font size=2 face="Courier New">
IToolBarContributionItem) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; IToolBarContributionItem tbci = (IToolBarContributionItem)
items[i];</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; releaseContributions((ContributionManager)
tbci</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; .getToolBarManager());</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#3f8080 face="Courier New">//
Now remove any cached information</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; ManagerPopulationRecord mpr = (ManagerPopulationRecord)
populatedManagers.remove(mgr);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>if</b></font><font size=2 face="Courier New">
(mpr != </font><font size=2 color=#820040 face="Courier New"><b>null</b></font><font size=2 face="Courier New">)</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mpr.releaseContributions();</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; managersAwaitingUpdates.remove(mgr);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; Obviously the passed in ContributionManager
is null. I've tested the existing topicmap (EMF/GMF example code) and it
behaves the same way. </font>
<br>
<br><font size=2 face="sans-serif">&nbsp; One other data point. If I manually
close the editor first, then I don't see this problem. My editor's dispose()
method is being called in both cases.</font>
<br>
<br>
<br><font size=2 face="sans-serif">&nbsp; Thoughts? Ideas?</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; Thanks!</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; Pierre</font>
<br>
<br>
--=_alternative 004600F3862574B4_=--
Previous Topic:Eclipse 3.4 on Windows XP Pro 64-bit
Next Topic:Problem during ant build with Ganymede RC2
Goto Forum:
  


Current Time: Sat Nov 09 23:13:31 GMT 2024

Powered by FUDForum. Page generated in 0.03347 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top