简体   繁体   English

Android致命信号错误11 SIGSEGV关于不同版本的JellyBean

[英]Android Fatal Signal Error 11 SIGSEGV On Different Versions of JellyBean

My coworker and I are experiencing very strange behavior with an Android Canvas object. 我的同事和我正在使用Android Canvas对象遇到非常奇怪的行为。

We're dealing with an initialized canvas object and are selectively getting a Fatal Signal 11 Error between 2 Nexus 7 tablets; 我们正在处理一个初始化的画布对象,并有选择地在2个Nexus 7平板电脑之间获得致命信号11错误; one of which runs 4.2.2 and works fine, and the other which runs 4.3 and crashes. 其中一个运行4.2.2并且工作正常,另一个运行4.3并崩溃。 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). 我们正试图弄清楚如何解决问题,包括确定错误是我们自己的问题,还是在Android API中以某种方式出现故障(不太可能)。

The error occurs when we try to call canvas.getWidth() on the object. 当我们尝试在对象上调用canvas.getWidth()时会发生错误。

Our Java code: ( not that it probably matters but Rect is from our codebase, it's not an android.graphics.Rect ) 我们的Java代码:( 不是说它可能很重要,但是Rect来自我们的代码库,它不是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 我们从LogCat获取的信息就在这里

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. 我们可能不得不重新构建Canvas,但是我们都很困惑,像Canvas这样常见的类在两个相同的平板电脑上表现不同。

Thank you very much for your support :) 非常感谢您的支持 :)

如果更改的标志为false,则不在第二个布局传递上呈现,这对我来说解决了这个问题。

We fixed this issue by simply assigning our Canvas object to null after using it. 我们通过简单地将Canvas对象在使用后赋值为null来修复此问题。 Under the hood this probably caused the Android API to reinitialize it with a valid address. 这可能导致Android API使用有效地址重新初始化它。

The problem has been solved, but the fact that the address issue got resolved implicitly on 4.2.2 and not on 4.3 is probably a bug and should be researched further. 问题已经解决了,但地址问题在4.2.2而不是4.3上隐含解决的事实可能是一个错误,应该进一步研究。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM