Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.86k stars 822 forks source link

Fix RenderTexture dispose() texture #1043

Closed Doppp closed 6 years ago

Doppp commented 6 years ago

_activeTexture was being disposed twice once in RenderTexture and once in SubTexture. Only dispose it in RenderTexture if SubTexture isn't going to dispose it.

PrimaryFeather commented 6 years ago

Thanks a lot for the pull request! Indeed, that dispose should not be called twice, as it is now — good catch!

I'd even go so far as to remove that dispose call inside RenderTexture completely. The active texture is always created in the constructor via Texture.empty() — and that returns either a concrete texture, or a sub-texture that owns its parent. Either way, super.dispose() will take care of it. So I'll remove that call completely.

Thanks again!

PrimaryFeather commented 6 years ago

... and I realized it needs to be done in a slightly different way (see above commit). :wink:

Doppp commented 6 years ago

Thanks very much, @PrimaryFeather!