Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Call to Canvas.getChildren causes destroy of non-canvas children

    Hello,

    We have a case where we call getChildren on a canvas, some of this canvases children are however not a canvas but an instance of Tab.

    Somehow this call ends up destroying that Tab instance, as visible in this trace:
    Code:
    om.smartgwt.client.core.JsObject$SGWT_WARN: 17:15:05.617:XRP4:WARN:Log:Specified ID: tab_0 collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:299)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.util.SC.logWarn(SC.java)
        at com.smartgwt.client.util.IDManager.validateID(IDManager.java:73)
        at com.smartgwt.client.util.IDManager.registerID(IDManager.java:122)
        at com.smartgwt.client.widgets.BaseWidget.internalSetID(BaseWidget.java:391)
        at com.smartgwt.client.widgets.Canvas.setJavaScriptObject(Canvas.java:57)
        at com.smartgwt.client.widgets.Canvas.<init>(Canvas.java:95)
        at sun.reflect.GeneratedConstructorAccessor64.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.smartgwt.client.util.ObjectFactory.createCanvas(ObjectFactory.java)
        at sun.reflect.GeneratedMethodAccessor406.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.smartgwt.client.widgets.Canvas.getByJSObject(Canvas.java)
        at com.smartgwt.client.util.ConvertTo.arrayOfCanvas(ConvertTo.java:2825)
        at com.smartgwt.client.widgets.Canvas.getChildren(Canvas.java:1047)
        at be.sofico.silkroad.client.custom.widgets.messagewindow.SilkMessageWindowImpl.discoverChildrenAndDisable(SilkMessageWindowImpl.java:1755)
        at be.sofico.silkroad.client.custom.widgets.messagewindow.SilkMessageWindowImpl.discoverChildrenAndDisable(SilkMessageWindowImpl.java:1794)
        at be.sofico.silkroad.client.custom.widgets.messagewindow.SilkMessageWindowImpl.discoverChildrenAndDisable(SilkMessageWindowImpl.java:1794)
        at be.sofico.silkroad.client.custom.widgets.messagewindow.SilkMessageWindowImpl.disableChildComponent(SilkMessageWindowImpl.java:1744)
        at be.sofico.silkroad.client.custom.widgets.messagewindow.SilkMessageWindowImpl.showError(SilkMessageWindowImpl.java:932)
        at be.sofico.silkroad.client.util.error.SilkClientErrorUtil.showSilkErrorFromDSLoader(SilkClientErrorUtil.java:427)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
        at java.lang.Thread.run(Thread.java:662)
    I can only think of the following reason: since it really isn't a canvas - it can't locate it properly and goes to the bean factory to create it.

    The ID of the component is assigned by use (tab_0).

    This doesn't feel right does it? We are on v9.0p_2013-10-27/Pro Deployment (built 2013-10-27).

    Thanks

    #2
    A Tab is not a subclass of Canvas, but if you provide an ID, the Canvas that is created from that Tab will have that ID, and so could collide with other widgets.

    See docs for tab.ID for more information.

    Comment


      #3
      Hi,

      I am probably missing something but the only relevant point in the documentation is that the ID should be unique, which it is.

      Note that all is well up to the point that we trigger getChildren on one of the parents of the tab(set). That leads to the destruction of the tab itself (because at some point it is using the ID passed into the getByJSObject method to recreate an object which currently does exist).

      Please have another look at this.

      Comment


        #4
        We'd be happy to take another look, but since there's no instantiation of tabs or anything of the kind triggered by getChildren(), we don't really even have a theory of how a spurious ID collision could occur here.

        So we need a way to reproduce the problem to investigate further.

        Comment


          #5
          Yes I know, it looks like a freak issue - the re-creation is accidental somehow. As far as I can tell the Canvas.getByJSObject method is not able to get the object by the first attempt to call 'getRef'. Looking in the debugger the __ref is not available (empty).
          Should there be another fallback to try to get the object by ID ($wnd[ID]) before attempting the create trough ObjectFactory::createCanvas?

          Comment


            #6
            No, a fallback is not appropriate here for reasons that run way too deep to cover on the forums.

            We just need a way to reproduce the problem, then we can take a look.

            Comment


              #7
              Ok, well a repro would be hard (involve a lot of work) - we have an embedded dev coming in this month, we'll have him take a look at it and maybe get back to you.

              Thanks

              Comment

              Working...
              X