Null pointer on workbench close [message #331302] |
Fri, 29 August 2008 12:44 |
Pierre Padovani 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"> 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"> </font><font size=2 color=#3f8080 face="Courier New">/*</font>
<br><font size=2 color=#3f8080 face="Courier New">
* (non-Javadoc)</font>
<br><font size=2 color=#3f8080 face="Courier New">
* </font>
<br><font size=2 color=#3f8080 face="Courier New">
* @see org.eclipse.ui.internal.menus.IMenuService#releaseMenu(org.e clipse.jface.action.ContributionManager) </font>
<br><font size=2 color=#3f8080 face="Courier New">
*/</font>
<br><font size=2 face="Courier New"> </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">
</font><font size=2 color=#3f8080 face="Courier New">//
Recursive remove any contributions from sub-menus</font>
<br><font size=2 face="Courier New">---->>>
IContributionItem[] items = mgr.getItems();</font>
<br><font size=2 face="Courier New">
</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 < items.length; i++) {</font>
<br><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">
ContributionManager) {</font>
<br><font size=2 face="Courier New">
releaseContributions((ContributionManager)
items[i]);</font>
<br><font size=2 face="Courier New">
} </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">
IToolBarContributionItem tbci = (IToolBarContributionItem)
items[i];</font>
<br><font size=2 face="Courier New">
releaseContributions((ContributionManager)
tbci</font>
<br><font size=2 face="Courier New">
.getToolBarManager());</font>
<br><font size=2 face="Courier New">
}</font>
<br><font size=2 face="Courier New">
}</font>
<br><font size=2 face="Courier New">
</font>
<br><font size=2 face="Courier New">
</font><font size=2 color=#3f8080 face="Courier New">//
Now remove any cached information</font>
<br><font size=2 face="Courier New">
ManagerPopulationRecord mpr = (ManagerPopulationRecord)
populatedManagers.remove(mgr);</font>
<br><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">
(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">
mpr.releaseContributions();</font>
<br><font size=2 face="Courier New">
managersAwaitingUpdates.remove(mgr);</font>
<br><font size=2 face="Courier New"> }</font>
<br>
<br><font size=2 face="sans-serif"> 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"> 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"> Thoughts? Ideas?</font>
<br>
<br><font size=2 face="sans-serif"> Thanks!</font>
<br>
<br><font size=2 face="sans-serif"> Pierre</font>
<br>
<br>
--=_alternative 004600F3862574B4_=--
|
|
|
Powered by
FUDForum. Page generated in 0.03347 seconds