|
|
|
Re: FIX FOR Menu.releaseWidget()/HOW TO report a bugfix?? [message #452082 is a reply to message #452015] |
Mon, 14 March 2005 12:37 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
Chris,
Please enter a bug report against Platform SWT with the problem you are
encountering. If possible, please include a code snippet that demonstrates
the problem.
"Chris" <chris.dagnon@tds.net> wrote in message
news:d0v6q2$87f$1@www.eclipse.org...
> SHORT VERSION: This may or may not be what's causing your errors, but it
> just happened to me and by debugging I have a fix for my problem (though I
> think it points out some problem with SWT's overall internal strategy).
> The fix code is adding a null check here:
>
> void releaseWidget () {
> MenuItem [] items = getItems ();
> for (int i=0; i<items.length; i++) {
> MenuItem item = items [i];
> if (item != null && !item.isDisposed ()) { // !!!!!!
> if (OS.IsPPC && hwndCB != 0) {
> item.dispose ();
> } else {
> item.releaseResources ();
> }
> }
> }
>
>
> LONG VERSION:
> I just came across this bug where if I have a Menu menu and do
> menu.addDisposeListener(dl); where dl does a System.out.println(), on the
> display.dispose() it gives me a similar error. In particular my
> breakpoint is in Menu.java @1048 using SWT win32.3.0.1, and the first time
> through (with an extensive stack of OS calls, which reports including 3
> sets of the same repeated lines...) it correctly disposes of them. That
> happens from display.readAndDispatch().
> The second time through is initiated from shell.dispose() and
> display.dispose() (I had both - had heard both were better than single),
> and they try looping through the MenuItems again but this time they are
> all null so on the first object->method call it bombs with NullPointer.
>
> Sometimes I can through WinXP's app bar select it and close it, but mostly
> I have to use Eclipse's debug window to terminate the app, because it
> throws the NullPointer
>
> Removing the println() call eliminates the eventual problem, but not the
> bug in the code.
>
|
|
|
Powered by
FUDForum. Page generated in 0.02906 seconds