Reputation: 863
Before you spend more time reading this than necessary: I will be answering this question myself. I spent a full day debugging this and thought I should share.
I am the developer for an application that is basically a sort of turn-by-turn navigation on golf courses. As such, I have images that need to be rotated to make the image north-oriented. This obviously requires some matrix transformations.
After Android 4.3 got pushed to the HTC One, I got a few complaints that the app was simply closing whenever someone wanted to use it. "Unfortunately has stopped."
My initial debug session didn't clear anything up. There was no exception being thrown, so nothing to step through initially. I found the following in my logs:
11-12 14:12:56.257: ASSERT/libc(5206): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 5206 (ndroid.appname)
With nowhere to really start debugging, I was in for a long run of old-school stepping through everything, identifying likely suspects and lots of caffeine but in the end I figured it out with the help of a colleague who had written the code that turned out to be the culprit.
Upvotes: 1
Views: 447
Reputation: 863
As it turns out, this line was causing all the issues: canvas.setMatrix(null);
The intent of this line was simple: reset the transformation matrix back to the identity matrix so that a new transformation could be applied. According to the documentation, this is allowed:
Completely replace the current matrix with the specified matrix. If the matrix parameter is null, then the current matrix is reset to identity.
Apparently the people working on Android removed this check for a null parameter from the 4.3 code but didn't deem it necessary to either update the documentation or throw a decent exception. Instead, this line just crashes everything without so much as a clue to where it happened and why.
I have filed a bug report if anyone's interested. I hope that it or this thread help someone in the same situation.
Upvotes: 2