My coworker and I are experiencing very strange behavior with an Android Canvas object.
We're dealing with an initialized canvas object and are selectively getting a Fatal Signal 11 Error between 2 Nexus 7 tablets; one of which runs 4.2.2 and works fine, and the other which runs 4.3 and crashes. We are trying to figure out how to go about troubleshooting the problem which involves determining if the error is on our part, or a glitch somehow in the Android API (unlikely).
The error occurs when we try to call canvas.getWidth()
on the object.
Our Java code: ( not that it probably matters but Rect is from our codebase, it's not an android.graphics.Rect
)
public Rect getViewportBounds() {
Canvas can = _diagram._canvas;
Rect vb = _viewportBounds;
if (can == null) return vb;
Point pos = _position;
int[] approxWindowVals = { (int) pos.getX(), (int) pos.getY() };
double sc = _scale;
vb._set(approxWindowVals[0], approxWindowVals[1], Math.max(can.getWidth(), 0) / sc, Math.max(can.getHeight(), 0) / sc);
return vb;
}
Our information from LogCat is here
08-09 16:49:14.883: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during layout: running second layout pass 08-09 16:49:14.893: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during second layout pass: posting in next frame 08-09 16:49:14.923: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during layout: running second layout pass 08-09 16:49:14.943: D/abc(4083): onDraw 08-09 16:49:14.943: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during second layout pass: posting in next frame 08-09 16:49:14.973: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during layout: running second layout pass 08-09 16:49:14.983: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during second layout pass: posting in next frame 08-09 16:49:15.003: W/View(4083): requestLayout() improperly called by com.nwoods.go.Viewport{41dfcb08 V.ED.... ......I. 0,0-0,0} during layout: running second layout pass 08-09 16:49:15.033: A/libc(4083): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 4083 (egressiontester)
Our hardware configurations are as follows:
+---------+------------+-----------------------+ | Tablet | Android OS | Reached Error | +---------+------------+-----------------------+ | Nexus 7 | 4.2.2 | NO | | Nexus 7 | 4.3 | YES | +---------+------------+-----------------------+
If you have any idea as to why this is happening please let me know. We might have to restructure the Canvas, but we're both pretty confused that a class as common as Canvas is behaving differently on two identical tablets.
Thank you very much for your support :)
Not rendering on the second layout pass if the changed flag is false solved this issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With