[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] disposing child LayoutComposite causes *menu* of *parent* LayoutComposite to be disposed?!

WinXP; R3.3

I'm using FormToolkit to create widgets; one of the widgets is the Composite created by FormToolkit.createComposite() (i.e., the subclass LayoutComposite). Call that first LayoutComposite "topLevel".

Next, I need to create children of "topLevel", and then from time to time, dispose() those children (to create a different GUI, or to dodge Bug 130024, or for whatever reason).

(A)
If I create as children of "topLevel" a Table or any of several other kinds of things I've tried, the dispose() followed be re-creation of the widgets all works just fine.


(B)
But if I create as a child of "topLevel" another LayoutComposite, call it "wrapper" (which I might want to do to get the children of "wrapper" to lay out correctly), then if I dispose the "wrapper" LayoutComposite, when I try to create new children of the "topLevel" LayoutComposite, I get this call-stack:


java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(SWT.java:3547)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at org.eclipse.swt.SWT.error(SWT.java:3452)
at org.eclipse.swt.widgets.Control.setMenu(Control.java:2880)
at org.eclipse.ui.forms.widgets.LayoutComposite.<init>(LayoutComposite.java:25)
at org.eclipse.ui.forms.widgets.FormToolkit.createComposite(FormToolkit.java:276)
at org.eclipse.ui.forms.widgets.FormToolkit.createComposite(FormToolkit.java:263)


Debugging through that code, it seems from Control, line 2880 that <code>menu.isDisposed()</code> returns *TRUE*! But the menu in question is (see LayoutComposite, line 25) the menu of the *PARENT* LayoutComposite.

So why does SWT dispose the *PARENT*'s menu?

thanks,
Paul