Closed greymag closed 7 years ago
Thanks for the report! Could you maybe create a sample that I can use to reproduce the problem? I'm not sure I understand it 100% by the description alone.
Yes, of course. The code below will throw null pointer exception after 500 ms delay
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.setTimeout;
import starling.core.Starling;
import starling.display.QuadBatch;
import starling.events.Event;
public class TestStarling extends flash.display.Sprite
{
private var _starling:Starling;
private var _qb:QuadBatch;
public function TestStarling()
{
Starling.handleLostContext = true;
_starling = new Starling(starling.display.Sprite, this.stage);
_starling.addEventListener(starling.events.Event.ROOT_CREATED, this.rootCreated);
_starling.start();
}
private function rootCreated(e:*):void
{
_starling.stage3D.addEventListener(flash.events.Event.CONTEXT3D_CREATE, this.onContextCreated);
_qb = new QuadBatch();
setTimeout(function ():void {
// initiate context lost
_starling.context.dispose();
}, 500)
}
private function onContextCreated(e:*):void
{
// dispose QuadBatch on context lost
_qb.dispose();
}
}
}
I just added a check that should avoid these problems. Sorry for the delay!
There is a problem In branch
origin/v1.8.x
after replace Starling event with conventional inQuadBatch
. Now, if someone disposeQuadBatch
in it's own context created listener, thenQuadBatch
will thrown 1009 error increateBuffers()
(called fromonContextCreated
). Thats becauseremoveEventListener()
are not remove event listener while handle this event