Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception caught: Cannot set a new parent without first clearing the old parent #627

Closed
youncta-dev opened this issue May 4, 2017 · 9 comments
Assignees
Milestone

Comments

@youncta-dev
Copy link

youncta-dev commented May 4, 2017

I'm using 2.0-SNAPSHOT in my project and since a few days I'm observing a nasty exception on Chrome developer console. I'm sure it was not happening on 21st of April but now it is popping up frequently.

How can I select a snapshot of a given day in the pom ?

This is the exception:

gwtmaterialylct-0.js:5485 Thu May 04 16:21:18 GMT+200 2017 com.google.gwt.logging.client.LogConfiguration
SEVERE: Exception caught: Cannot set a new parent without first clearing the old parent
com.google.gwt.user.client.ui.AttachDetachException: Exception caught: Cannot set a new parent without first clearing the old parent
	at Unknown.RuntimeException_1(gwtmaterialylct-0.js)
	at Unknown.UmbrellaException(gwtmaterialylct-0.js)
	at Unknown.UmbrellaException_0(gwtmaterialylct-0.js)
	at Unknown.AttachDetachException(gwtmaterialylct-0.js)
	at Unknown.tryCommand(gwtmaterialylct-0.js)
	at Unknown.doAttachChildren_0(gwtmaterialylct-0.js)
	at Unknown.$onAttach(gwtmaterialylct-0.js)
	at Unknown.onAttach(gwtmaterialylct-0.js)
	at Unknown.$setParent(gwtmaterialylct-0.js)
	at Unknown.$add_2(gwtmaterialylct-0.js)
	at Unknown.$add_7(gwtmaterialylct-0.js)
	at Unknown.add_8(gwtmaterialylct-0.js)
	at Unknown.$add_1(gwtmaterialylct-0.js)
	at Unknown.$add_6(gwtmaterialylct-0.js)
	at Unknown.add_7(gwtmaterialylct-0.js)
	at Unknown.setInSlot(gwtmaterialylct-0.js)
	at Unknown.$setInSlot(gwtmaterialylct-0.js)
	at Unknown.execute_19(gwtmaterialylct-0.js)
	at Unknown.runScheduledTasks(gwtmaterialylct-0.js)
	at Unknown.$flushPostEventPumpCommands(gwtmaterialylct-0.js)
	at Unknown.execute_2(gwtmaterialylct-0.js)
	at Unknown.execute_1(gwtmaterialylct-0.js)
	at Unknown.apply_1(gwtmaterialylct-0.js)
	at Unknown.entry0(gwtmaterialylct-0.js)
	at Unknown.anonymous(gwtmaterialylct-0.js)
	at Unknown.callback(gwtmaterialylct-0.js)
Caused by: java.lang.IllegalStateException: Cannot set a new parent without first clearing the old parent
	at Unknown.Exception(gwtmaterialylct-0.js)
	at Unknown.RuntimeException_0(gwtmaterialylct-0.js)
	at Unknown.IllegalStateException_0(gwtmaterialylct-0.js)
	at Unknown.$setParent(gwtmaterialylct-0.js)
	at Unknown.$add_2(gwtmaterialylct-0.js)
	at Unknown.$add_7(gwtmaterialylct-0.js)
	at Unknown.add_8(gwtmaterialylct-0.js)
	at Unknown.$add_1(gwtmaterialylct-0.js)
	at Unknown.$add_6(gwtmaterialylct-0.js)
	at Unknown.initialize_4(gwtmaterialylct-15.js)
	at Unknown.$onLoad_0(gwtmaterialylct-0.js)
	at Unknown.onLoad_7(gwtmaterialylct-0.js)
	at Unknown.$onAttach(gwtmaterialylct-0.js)
	at Unknown.onAttach(gwtmaterialylct-0.js)
	at Unknown.execute_5(gwtmaterialylct-0.js)
	at Unknown.tryCommand(gwtmaterialylct-0.js)
	at Unknown.doAttachChildren_0(gwtmaterialylct-0.js)
	at Unknown.$onAttach(gwtmaterialylct-0.js)
	at Unknown.onAttach(gwtmaterialylct-0.js)
	at Unknown.$setParent(gwtmaterialylct-0.js)
	at Unknown.$add_2(gwtmaterialylct-0.js)
	at Unknown.$add_7(gwtmaterialylct-0.js)
	at Unknown.add_8(gwtmaterialylct-0.js)
	at Unknown.$add_1(gwtmaterialylct-0.js)
	at Unknown.$add_6(gwtmaterialylct-0.js)
	at Unknown.add_7(gwtmaterialylct-0.js)
	at Unknown.setInSlot(gwtmaterialylct-0.js)
	at Unknown.$setInSlot(gwtmaterialylct-0.js)
	at Unknown.execute_19(gwtmaterialylct-0.js)
	at Unknown.runScheduledTasks(gwtmaterialylct-0.js)
	at Unknown.$flushPostEventPumpCommands(gwtmaterialylct-0.js)
	at Unknown.execute_2(gwtmaterialylct-0.js)
	at Unknown.execute_1(gwtmaterialylct-0.js)
	at Unknown.apply_1(gwtmaterialylct-0.js)
	at Unknown.entry0(gwtmaterialylct-0.js)
	at Unknown.anonymous(gwtmaterialylct-0.js)
	at Unknown.callback(gwtmaterialylct-0.js)


@kevzlou7979
Copy link
Contributor

kevzlou7979 commented May 5, 2017

What specific GMD components you've used in order to reproduce this issue? Thanks in advance

@youncta-dev
Copy link
Author

ApplicationView.ui.xml.gz
SystemSummaryView.ui.xml.gz

Second time I click to show SystemSummaryView I get the exception. Probably the navigation side bar is causing the problem. You can see it in this video:

https://youtu.be/x86PwZfOio4

@youncta-dev
Copy link
Author

I'm also using gwt-material-table 2.0-SNAPSHOT in my project

@kevzlou7979
Copy link
Contributor

@youncta-dev I think it's not the navigation side bar as it's not reattaching on your demo, the only thing that is reattaching is your content.

@youncta-dev
Copy link
Author

As an info for you, I can state that the problem disappears if I use the following instead of SNAPSHOT:


    <parent>
        <artifactId>gwt-material-parent</artifactId>
        <groupId>com.github.gwtmaterialdesign</groupId>
        <version>2.0-20170421.032733-302</version>
    </parent>

        <dependency>
            <groupId>com.github.gwtmaterialdesign</groupId>
            <artifactId>gwt-material</artifactId>
            <version>2.0-20170421.032828-298</version>
        </dependency>
        <dependency>
            <groupId>com.github.gwtmaterialdesign</groupId>
            <artifactId>gwt-material-themes</artifactId>
            <version>2.0-20170427.080029-20</version>
        </dependency>
        <dependency>
            <groupId>com.github.gwtmaterialdesign</groupId>
            <artifactId>gwt-material-addins</artifactId>
            <version>2.0-20170424.095630-196</version>
        </dependency>

        <dependency>
            <groupId>com.github.gwtmaterialdesign</groupId>
            <artifactId>gwt-material-table</artifactId>
            <version>2.0-20170502.071319-13</version>
        </dependency>


@brkuntmz
Copy link

brkuntmz commented May 5, 2017

With the new version, don't know why, some components started to act weirdly. For example, I was having the similar type of exception during the attachment and detachment of components, and in my case, the problematic component was MaterialWindow.

So, I did a workaround solution as the following:

if(somewindow.isAttached()){
    RootPanel.get().remove(somewindow);
}
RootPanel.get().add(somewindow);

Inside the view constructor, I simply removed the component from the RootPanel if it's attached (because the error was saying "cannot add another parent while the old one is there")and added again to bypass the error. However, the workaround solution is for sure not elegant although it does the trick.

So, you should find the right component for you which causes the problem. At least until a fix is released.

@matam
Copy link

matam commented May 5, 2017

I'm also had problem with MaterialWindow https://github.com/GwtMaterialDesign/gwt-material-addins/issues/229, but now this error not exist and i closed this issue.

@kevzlou7979
Copy link
Contributor

Ok I confirmed that I can reproduce this issue on Demo snapshot Window page.

@kevzlou7979
Copy link
Contributor

@kevzlou7979 kevzlou7979 self-assigned this May 8, 2017
@kevzlou7979 kevzlou7979 added this to the 2.0 milestone May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants