You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/11/30 07:35:19 UTC

[GitHub] [royale-asjs] estanglerbm opened a new issue #963: ArgumentError: Error #2024: An object cannot be added as a child of itself.

estanglerbm opened a new issue #963:
URL: https://github.com/apache/royale-asjs/issues/963


   In Flash Debug Player--after dealing with various VerifyError issues related to issue #953--getting error
   
   `ArgumentError: Error #2024: An object cannot be added as a child of itself.`
   
   on any Spark application (haven't tried other types).  Full stack:
   
   ```
   ArgumentError: Error #2024: An object cannot be added as a child of itself.
   	at flash.display::DisplayObjectContainer/addChild()
   	at org.apache.royale.core::UIBase/$sprite_addChild()[/org/apache/royale/0.9.8/org/apache/royale/core/UIBase.as:1564]
   	at org.apache.royale.core::UIBase/addElement()[/org/apache/royale/0.9.8/org/apache/royale/core/UIBase.as:1170]
   	at mx.core::UIComponent/addElement()[/org/apache/royale/0.9.8/mx/core/UIComponent.as:6109]
   	at spark.components::SkinnableContainer/$addElement()[/org/apache/royale/0.9.8/spark/components/SkinnableContainer.as:1384]
   	at org.apache.royale.core::ContainerBaseStrandChildren/addElement()[/org/apache/royale/0.9.8/org/apache/royale/core/ContainerBaseStrandChildren.as:67]
   	at org.apache.royale.html.beads::ContainerView/addViewport()[/org/apache/royale/0.9.8/org/apache/royale/html/beads/ContainerView.as:147]
   	at spark.components.beads::SkinnableContainerView/addViewport()[/org/apache/royale/0.9.8/spark/components/beads/SkinnableContainerView.as:120]
   	at org.apache.royale.html.beads::ContainerView/set strand()[/org/apache/royale/0.9.8/org/apache/royale/html/beads/ContainerView.as:139]
   	at spark.components.beads::SparkContainerView/set strand()[/org/apache/royale/0.9.8/spark/components/beads/SparkContainerView.as:65]
   	at org.apache.royale.core::HTMLElementWrapper/addBead()[/org/apache/royale/0.9.8/org/apache/royale/core/HTMLElementWrapper.as:66]
   	at org.apache.royale.core::UIBase/addBead()[/org/apache/royale/0.9.8/org/apache/royale/core/UIBase.as:1143]
   	at global/org.apache.royale.utils::loadBeadFromValuesManager()[/org/apache/royale/0.9.8/org/apache/royale/utils/loadBeadFromValuesManager.as:55]
   	at org.apache.royale.core::UIBase/addedToParent()[/org/apache/royale/0.9.8/org/apache/royale/core/UIBase.as:1398]
   	at mx.core::UIComponent/addedToParent()[/org/apache/royale/0.9.8/mx/core/UIComponent.as:1991]
   	at spark.components::SkinnableContainer/addedToParent()[/org/apache/royale/0.9.8/spark/components/SkinnableContainer.as:980]
   	at mx.managers::SystemManager/addChild()[/org/apache/royale/0.9.8/mx/managers/SystemManager.as:1596]
   	at mx.managers::SystemManager/initializeTopLevelWindow()[/org/apache/royale/0.9.8/mx/managers/SystemManager.as:2987]
   	at mx.managers::SystemManager/kickOff()[/org/apache/royale/0.9.8/mx/managers/SystemManager.as:2831]
   	at mx.managers::SystemManager/docFrameHandler()[/org/apache/royale/0.9.8/mx/managers/SystemManager.as:2710]
   ```
   
   Ultimately, this is because ContainerView.addViewport() is doing:
   
   `chost.strandChildren.addElement(viewport.contentView);`
   
   where chost == viewport.contentView, because SkinnableContainerView.addViewport() is not checking that chost != viewport.contentView before calling super.addViewport().
   
   (Then the SWF-specific code in UIBase.addElement() is calling $sprite_addChild(), which doesn't like it.)
   
   What needs to be added with addElement, in the SWF case?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #963: ArgumentError: Error #2024: An object cannot be added as a child of itself.

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #963:
URL: https://github.com/apache/royale-asjs/issues/963#issuecomment-739448689


   I'd recommend stepping through the same code on the JS side.  I suspect that SparkContainerView either doesn't add a viewport and just assigns itself as the viewport, or adding yourself somehow doesn't throw an error, and nobody has tried it on SWF.
   
   Conceptually, each bead is an encapsulation of some piece of functionality.  A View is in charge of the display list, Viewports are in charge of the portion of the display list you can see.  Different runtimes/platforms have different feature sets so when you need to do something like clipping or scrolling, the beads in charge of that contain the code to do it, often with conditional compilation for each runtime/platform implementation.
   
   Different component sets present different APIs for the consumer.  Some might bias a bit towards HTML/JS/CSS, others, like the emulation, are required to present legacy APIs.  A Spark Container has legacy APIs for clipping and scrolling.  I think there is a functional implementation for JS.  Obviously not for SWF.  So how to fix it for SWF?  Look at the Flash APIs, figure out what to do, and implement it appropriately in the View and Viewport beads, adding SWF-specific support beads if needed.  It is ok for the SWF implementation to be completely different from the JS implementation.
   
   The JS implementation can take advantage of the HTMLElements having built-in clipping and scrolling.  SWF code has to do more work, IIRC.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] estanglerbm commented on issue #963: ArgumentError: Error #2024: An object cannot be added as a child of itself.

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #963:
URL: https://github.com/apache/royale-asjs/issues/963#issuecomment-755384512


   This is fixed by PR #1041. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] estanglerbm closed issue #963: ArgumentError: Error #2024: An object cannot be added as a child of itself.

Posted by GitBox <gi...@apache.org>.
estanglerbm closed issue #963:
URL: https://github.com/apache/royale-asjs/issues/963


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] estanglerbm commented on issue #963: ArgumentError: Error #2024: An object cannot be added as a child of itself.

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #963:
URL: https://github.com/apache/royale-asjs/issues/963#issuecomment-739125264


   This doesn't happen for Jewel or MX apps.  It's specific to Spark.
   
   So the question is, is this intentionally adding itself as a child of itself?  That is, is this a silent bug in JS, too?
   
   I'm not looking for a specific fix.  I'm looking for conceptual assistance here.  (Probably specific to Spark emulation.  Even though this involves Basic ContainerView.addViewport(), nobody else calls this function except Spark.)
   
   (FYI, running this stuff in Flash Debug Player is not about getting Royale to generate SWF files;  Flex is good at that.  This is about comparing Flex vs. Royale behavior, and another tool for finding bugs in Royale.)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] greg-dove commented on issue #963: ArgumentError: Error #2024: An object cannot be added as a child of itself.

Posted by GitBox <gi...@apache.org>.
greg-dove commented on issue #963:
URL: https://github.com/apache/royale-asjs/issues/963#issuecomment-739128794


   Quick comment re: "(FYI, running this stuff in Flash Debug Player is not about getting Royale to generate SWF files; Flex is good at that. This is about comparing Flex vs. Royale behavior, and another tool for finding bugs in Royale.)"
   
   This was definitely one of the justifications for maintaining the swf side of the framework code, but it's fair to say that there are different priorities amongst the contributor community. 
   I tend to find this type of validation useful also, because it is the flash player (or AIR) is the best reference we have for the display side of things, and probably the most convenient for verifying behaviour of language level features (Vector/XML/Class/uint/int etc).
   Have you seen the unit tests in the framework build? They can be run from the ant scripts and they run the same tests in the flash projector as they do in the browser.
   
   
   
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org