
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
SWF 9, OL 4.0.6 (Compiling to swf8)
|
|
| Severity: |
Critical
|
| Runtime: |
N/A
|
| Fix in hand: |
True
|
|
LzView's recursive Sprite destruction is not working.
When a LzView is destroyed using destroy() method, it unregister itself from parent's subviews array.
After that, it calls to super.destroy() --LZNode.destroy()-- and then LzView.destroy(true) is called for each subnode.
When children's destructor is called whith recursiveCall == true, the LzSprite.destroy() method is not called for child.sprite
causing a Memory and resource Leaks (Sprite movieclip's aren't removed).
The original LzView method has the following code:
...
super.destroy.apply(this, arguments);
if ( recursiveCall == true ) { return; }
if (this.sprite) { this.sprite.destroy(recursiveCall) }
...
I think it must be:
...
super.destroy.apply(this, arguments);
if (this.sprite) { this.sprite.destroy(recursiveCall) }
if ( recursiveCall == true ) { return; }
...
I don't know if there is some collateral effects of calling LzSprite.destroy(true) for each subview
(we must remember the recursive call to child.destroy(true) in LzNode). Probably, there is a exponential number of calls to sprite.destroy()).
(a call for each subnode and a call to LzSprite.destroy(true) for each subview found in the node hierarchy iteration)
To prevent that exponential number of calls, clearing each subview' sprite addingthe following code will suffice
LzSprite.prototype.destroy = function(recursive){
if (recursive) {
if (this.owner.subviews) {
for (var i = 0; i < this.owner.subviews.length; i++) {
this.owner.subviews[i].sprite.destroy(recursive);
//ADDED CODE BEGIN
this.owner.subviews[i].sprite = null ;
//ADDED CODE END
}
}
}
But i'm not sure about it and i haven't tested.
At least the LzView Patch works (it doesn't crash Flash)
|
|
Description
|
LzView's recursive Sprite destruction is not working.
When a LzView is destroyed using destroy() method, it unregister itself from parent's subviews array.
After that, it calls to super.destroy() --LZNode.destroy()-- and then LzView.destroy(true) is called for each subnode.
When children's destructor is called whith recursiveCall == true, the LzSprite.destroy() method is not called for child.sprite
causing a Memory and resource Leaks (Sprite movieclip's aren't removed).
The original LzView method has the following code:
...
super.destroy.apply(this, arguments);
if ( recursiveCall == true ) { return; }
if (this.sprite) { this.sprite.destroy(recursiveCall) }
...
I think it must be:
...
super.destroy.apply(this, arguments);
if (this.sprite) { this.sprite.destroy(recursiveCall) }
if ( recursiveCall == true ) { return; }
...
I don't know if there is some collateral effects of calling LzSprite.destroy(true) for each subview
(we must remember the recursive call to child.destroy(true) in LzNode). Probably, there is a exponential number of calls to sprite.destroy()).
(a call for each subnode and a call to LzSprite.destroy(true) for each subview found in the node hierarchy iteration)
To prevent that exponential number of calls, clearing each subview' sprite addingthe following code will suffice
LzSprite.prototype.destroy = function(recursive){
if (recursive) {
if (this.owner.subviews) {
for (var i = 0; i < this.owner.subviews.length; i++) {
this.owner.subviews[i].sprite.destroy(recursive);
//ADDED CODE BEGIN
this.owner.subviews[i].sprite = null ;
//ADDED CODE END
}
}
}
But i'm not sure about it and i haven't tested.
At least the LzView Patch works (it doesn't crash Flash)
|
Show » |
|
LPP-4879.What I did was to restore "destroy" in SWF-runtime, so it'd work like in OL3.x times: Only the top-most MovieClip gets destroyed by "__LZFinishDestroyOnIdle".