Skip to content

AVM2: Child objects should be instantiated and assigned by super constructor #2916

@ZingBallyhoo

Description

@ZingBallyhoo

Currently they are only created and assigned on the next(/first) frame which causes crashes when the property is accessed in the constructor.

repro cases.zip

main_addframescript.swf

Ruffle
[2021-01-27T23:54:58Z INFO  ruffle_core::backend::log] Main ctor start
[2021-01-27T23:54:58Z INFO  ruffle_core::backend::log] this.clearCacheMsg_mc undefined
[2021-01-27T23:54:58Z INFO  ruffle_core::backend::log] this.clearCacheMsg_mc undefined
[2021-01-27T23:54:58Z INFO  ruffle_core::backend::log] Main ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] loader_2 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] loader_2 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] loaderBG_3 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] loaderBG_3 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] loadBar_7 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] loadBar_7 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] msgSplat_12 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] msgSplat_12 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] wrappers_78 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] wrappers_78 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] level_81 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] level_81 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] levelIndicator_82 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] levelIndicator_82 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] weevilStats_86 ctor start
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] weevilStats_86 ctor end
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] frame1 - this.clearCacheMsg_mc [object msgSplat_12]
[2021-01-27T23:55:00Z INFO  ruffle_core::backend::log] frame1 - this.clearCacheMsg_mc [object msgSplat_12]
Flash
trace: Main ctor start
trace: this.clearCacheMsg_mc null
trace: loader_2 ctor start
trace: loaderBG_3 ctor start
trace: loaderBG_3 ctor end
trace: loadBar_7 ctor start
trace: loadBar_7 ctor end
trace: loader_2 ctor end
trace: msgSplat_12 ctor start
trace: msgSplat_12 ctor end
trace: wrappers_78 ctor start
trace: level_81 ctor start
trace: levelIndicator_82 ctor start
trace: levelIndicator_82 ctor end
trace: level_81 ctor end
trace: weevilStats_86 ctor start
trace: weevilStats_86 ctor end
trace: wrappers_78 ctor end
trace: this.clearCacheMsg_mc [object msgSplat_12]
trace: Main ctor end
trace: frame1 - this.clearCacheMsg_mc [object msgSplat_12]

main_nosupercall.swf

super() call removed from Main, in Flash the children are no longer instantiated.
For some reason on Flash this makes the button disappear?

Ruffle
[2021-01-27T23:56:12Z INFO  ruffle_core::backend::log] Main ctor start
[2021-01-27T23:56:12Z INFO  ruffle_core::backend::log] this.clearCacheMsg_mc undefined
[2021-01-27T23:56:12Z INFO  ruffle_core::backend::log] Main ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] loader_2 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] loader_2 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] loaderBG_3 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] loaderBG_3 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] loadBar_7 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] loadBar_7 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] msgSplat_12 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] msgSplat_12 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] wrappers_78 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] wrappers_78 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] level_81 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] level_81 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] levelIndicator_82 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] levelIndicator_82 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] weevilStats_86 ctor start
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] weevilStats_86 ctor end
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] frame1 - this.clearCacheMsg_mc [object msgSplat_12]
[2021-01-27T23:56:14Z INFO  ruffle_core::backend::log] frame1 - this.clearCacheMsg_mc [object msgSplat_12]

image

Flash
trace: Main ctor start
trace: this.clearCacheMsg_mc null
trace: Main ctor end
trace: frame1 - this.clearCacheMsg_mc null

image

Metadata

Metadata

Assignees

Labels

A-avm2Area: AVM2 (ActionScript 3)bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions