Help! I discovered that my new app is crashing on iPhones. As far as I can tell, the crash seems to be happening deep inside Legacy NME code, and is tied to the Blur filter (when I remove all the filters, no crash). What’s really weird is that it’s only iOS, and only on the device – I wasn’t able to replicate in the simulator. See the following short program for an example – it consistently crashes on my iPad within 5-30 seconds.
package;
import openfl.display.Sprite;
import openfl.text.TextField;
import openfl.filters.BlurFilter;
import openfl.events.Event;
import openfl.text.Font;
import openfl.text.TextFormat;
@:font( "Assets/YanoneKaffeesatz-Light.ttf" ) class FYanone extends Font {}
class Main extends Sprite {
private var tf : Array<TextField>;
public function new () {
super ();
Font.registerFont( FYanone );
var fmt = new TextFormat(
"Yanone Kaffeesatz Light", 200, 0x000000 );
tf = new Array<TextField>();
for( i in 0...20 ) {
var t = new TextField();
t.defaultTextFormat = fmt;
t.text = "Weird Bug";
addChild( t );
t.x = 100;
t.y = 100;
t.width = 1000;
t.height = 200;
t.filters = [new BlurFilter( 10, 10, openfl.filters.BitmapFilterQuality.LOW )];
tf.push( t );
}
addEventListener( Event.ENTER_FRAME, onEnter );
}
private function onEnter( ev )
{
for( i in 0...20 ) {
var a = Math.random() * 5000 - 2000;
var b = Math.random() * 5000 - 2000;
tf[i].x = a;
tf[i].y = b;
}
}
}
For reference, here’s the top part of the stack trace in Xcode:
#0 0x0009ea4c in nme::BlurRow(nme::ARGB const*, int, int, int, nme::ARGB*, int, int, int, int) ()
#1 0x000a03ae in void nme::BlurFilter::DoApply<nme::ARGB>(nme::Surface const*, nme::Surface*, nme::Point2D<int>, nme::Point2D<int>, int) const ()
#2 0x0009ebae in nme::BlurFilter::Apply(nme::Surface const*, nme::Surface*, nme::Point2D<int>, nme::Point2D<int>, int) const ()
#3 0x000a004a in nme::FilterBitmap(nme::QuickVec<nme::Filter*, 16> const&, nme::Surface*, nme::TRect<int> const&, nme::TRect<int> const&, bool, nme::Point2D<int>) ()
#4 0x000947c4 in nme::DisplayObjectContainer::Render(nme::RenderTarget const&, nme::RenderState const&) ()
#5 0x00094150 in nme::DisplayObjectContainer::Render(nme::RenderTarget const&, nme::RenderState const&) ()
#6 0x00094150 in nme::DisplayObjectContainer::Render(nme::RenderTarget const&, nme::RenderState const&) ()
#7 0x0009609a in nme::Stage::RenderStage() ()
#8 0x000a3ffe in nme_render_stage(_value*) ()
Any thoughts on what might be going wrong, and how to work around it? Obviously I could just not use blurring, and I’ll do that if no other fix is possible. (If you’re going to test this, substitute in your favourite font as an alternative.)
Thanks.