Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355050 - Add of composite to tab item in XWT Form causes a stack overflow
Summary: Add of composite to tab item in XWT Form causes a stack overflow
Status: CLOSED FIXED
Alias: None
Product: XWT
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 major with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Yves YANG CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-18 06:18 EDT by Joerg Reichert CLA
Modified: 2014-08-07 07:52 EDT (History)
5 users (show)

See Also:


Attachments
The form before adding the composite (1012 bytes, text/plain)
2011-08-18 06:19 EDT, Joerg Reichert CLA
no flags Details
The project containing the copied XWT libraries (32.52 KB, image/jpeg)
2011-08-18 06:20 EDT, Joerg Reichert CLA
no flags Details
possible solution (600 bytes, patch)
2014-07-14 04:25 EDT, Matteo Di Liberto Gasparin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Reichert CLA 2011-08-18 06:18:55 EDT
Build Identifier: Eclipse 3.7 20110615-0604

I actually posted this bug first as an WindowBuilder bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=354908), but it seems to be more a XWT bug.

The XWT Form Composite wizard copies some libraries into the project, e.g. org.eclipse.e4.xwt_0.9.1.SNAPSHOT.jar (see also the appended workspace screenshot).

I appended the hole forms file in the state before adding the composite.

When adding a composite element as a child of a tabitem a StackOverflow is
caused. This is the code produced in the XML-File:

        <TabItem text="A">
            <TabItem.control>
                <Composite/>
            </TabItem.control>
        </TabItem>


!ENTRY org.eclipse.wb.core 4 4 2011-08-17 08:58:05.895
!MESSAGE Designer [1.0.0.r37x201106081531.201108170858]:
java.lang.StackOverflowError
!STACK 0
java.lang.StackOverflowError
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.initialize(AbstractMetaclass.java:614)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.assertInitialize(AbstractMetaclass.java:610)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:360)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:361)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:361)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:361)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)


Maybe the problem is that the Window Builder wizard uses the SNAPSHOT version of the XWT library.

Reproducible: Always

Steps to Reproduce:
1. Create new plug-in project
2. Create package in src
3. Create a new XWT file with the XWT Forms Composite wizard
4. Create TabFolder with TabItems
5. Try to add a composite to the TabItem
Comment 1 Joerg Reichert CLA 2011-08-18 06:19:31 EDT
Created attachment 201705 [details]
The form before adding the composite
Comment 2 Joerg Reichert CLA 2011-08-18 06:20:07 EDT
Created attachment 201706 [details]
The project containing the copied XWT libraries
Comment 3 Matteo Di Liberto Gasparin CLA 2014-05-13 03:24:13 EDT
The problem seems to be at the end of the method doNewInstance in org.eclipse.xwt.forms.metaclass.AbstractFormMetaclass where there should be a call to super.doNewInstance instead of super.newInstance. I can't provide a patch right now, but this seems pretty trivial.

Similar to this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=425450
Comment 4 Matteo Di Liberto Gasparin CLA 2014-07-14 04:25:55 EDT
Created attachment 245027 [details]
possible solution
Comment 5 Yves YANG CLA 2014-07-28 08:25:20 EDT
Thanks for the report. We'll check it out.
Comment 6 Sascha Hanke CLA 2014-07-28 08:44:10 EDT
Matteo Di Liberto Gasparin's solution works for me.
Comment 7 Yves YANG CLA 2014-08-07 07:52:17 EDT
Valided and committed.