I have a working android game which occasionally force closes on slow devices with the error
Fatal signal 6 (SIGABRT), code -6 in tid 14620 (AsyncTask #1)
Research indicated to me that this was due to delaying the execution of the UI thread, so, i bundled up the peace of code (about 200 lines of bitmap and region creation) into an AsyncTask (doInBackground method) and i now run that task from the UI thread using task.execute.
The problem is, this has in no way stopped the error. If anything the app force closes more frequently during the execution of that code despite the fact it should be running in an asyncTask.
In the interest of being thorough, the error is triggered during the execution of this part of the code (extract from the 200ish block):
Back.outerPath.setFillType(Path.FillType.EVEN_ODD);
Region tempRegion = new Region(PathBoundsRectangle);
Back.outerRegion.setPath(Back.outerPath, tempRegion);
Back.innerRegion.setPath(Back.innerPath, tempRegion);
Back.fastRegion.setPath(Back.speedPath, tempRegion);
Back.slowRegion.setPath(Back.slowPath, tempRegion);
Back.outerRegion.op(Back.innerRegion, Region.Op.XOR);
Matrix scaleMatrix = new Matrix();
RectF rectF = new RectF();
Back.innerPath.computeBounds(rectF, true);
scaleMatrix.setScale(1.1f, 1.1f,rectF.centerX(),rectF.centerY());
Back.innerPath.transform(scaleMatrix);
Back.outerPath.computeBounds(rectF, true);
scaleMatrix.setScale(0.9f, 0.9f,rectF.centerX(),rectF.centerY());
Back.outerPath.transform(scaleMatrix);
Back.outerSideBandRegion.setPath(Back.outerPath, tempRegion);
Back.outerSideBandRegion.op(Back.outerRegion, Region.Op.XOR);
Back.innerSideBandRegion.setPath(Back.innerPath, tempRegion);
Back.innerSideBandRegion.op(Back.innerRegion, Region.Op.XOR);
Any ideas? Is it possible the code is still running on the UI thread? Can this error be due to something else?
EDIT: It turns out the error is coming from the Region.op.XOR manipulations. Anyone see how this could cause a Fatal Error?