[Android-development] SIGSEGV in libQt5Gui.so

Bartosz Ludwig bartosz.ludwig at gmail.com
Mon Dec 15 12:55:46 CET 2014


Hello,

I'm developing a quite complex Qt5-based Android Application. I'm using Qt
5.3.2 and compiling against arm-v7a (-march=armv7-a -mfpu=vfpv3-d16
-mfloat-abi=softfp -mthumb).

I'm experiencing very random crashes of the Application (most of the time
it works fine, the issue is very hard to reproduce - in fact, it occured
only once...). I have to admit that I do not have exhausting information
what went wrong, but maybe someone had similar problem...

The Application crashed just after it was started. After that I found in
logcat:
(...)
12-12 16:15:03.690   675   675 D dalvikvm: Trying to load lib
/data/data/my.app/lib/libMyApp.so 0x4122e558
12-12 16:15:04.060   675   675 D dalvikvm: Added shared lib
/data/data/my.app/lib/libMyApp.so 0x4122e558
12-12 16:15:04.060   675   675 D dalvikvm: No JNI_OnLoad found in
/data/data/my.app/lib/libMyApp.so 0x4122e558, skipping init
(...)
12-12 16:15:04.360   675   675 D dalvikvm: Trying to load lib
/data/data/my.app/lib/libMyApp.so 0x4122e558
12-12 16:15:04.360   675   675 D dalvikvm: Shared lib
'/data/data/my.app/lib/libMyApp.so' already loaded in same CL 0x4122e558
12-12 16:15:04.380   675   855 W Qt      : kernel/qcoreapplication.cpp:433
(QCoreApplicationPrivate::QCoreApplicationPrivate(int&, char**, uint)):
WARNING: QApplication was not created in the main() thread.
12-12 16:15:07.652   675   830 W Qt      : painting/qpaintdevice.cpp:55
(virtual QPaintDevice::~QPaintDevice()): QPaintDevice: Cannot destroy paint
device that is being painted
12-12 16:15:07.652   675   855 F libc    : Fatal signal 11 (SIGSEGV) at
0x5e94d000 (code=1)
12-12 16:15:07.652   675   830 W Qt      : kernel/qcoreapplication.cpp:1176
(static int QCoreApplication::exec()): QApplication::exec: Must be called
from the main thread
12-12 16:15:10.602   675   675 D OpenGLRenderer: Flushing caches (mode 0)

Please note that libMyApp.so was apparently loaded twice. Usually this not
happen... (and there is no "already loaded in same CL" message). What's
more, during the normal Application start I can not see any warnings about
QApplication not created in the main thread.

I also managed to get the following stack trace:

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 5e94d000
Stack frame #00  pc 0018fb40  /data/data/my.app/lib/libQt5Gui.so: Routine
qt_blend_argb32_on_argb32(unsigned char*, int, unsigned char const*, int,
int, int, int) at qblendfunctions.cpp:?
Stack frame #01  pc 001d1208  /data/data/my.app/lib/libQt5Gui.so: Routine
QRasterPaintEnginePrivate::drawImage(QPointF const&, QImage const&, void
(*)(unsigned char*, int, unsigned char const*, int, int, int, int), QRect
const&, int, QRect const&) at moc_qopenglengineshadermanager_p.cpp:?
Stack frame #02  pc 001d43ce  /data/data/my.app/lib/libQt5Gui.so
(_ZN18QRasterPaintEngine9drawImageERK7QPointFRK6QImage): Routine
QRasterPaintEngine::drawImage(QPointF const&, QImage const&) at ??:?
Stack frame #00  pc 0000d384  /system/lib/libc.so (epoll_wait)
Stack frame #01  pc 00026e50  /system/lib/libutils.so
(_ZN7android6Looper9pollInnerEi)
Stack frame #02  pc 0002707e  /system/lib/libutils.so
(_ZN7android6Looper8pollOnceEiPiS1_PPv)
Stack frame #03  pc 0005b13c  /system/lib/libandroid_runtime.so
(_ZN7android18NativeMessageQueue8pollOnceEi)
Stack frame #04  pc 0005b146  /system/lib/libandroid_runtime.so
Stack frame #05  pc 0001ec30  /system/lib/libdvm.so (dvmPlatformInvoke)
Stack frame #06  pc 000593ca  /system/lib/libdvm.so
(_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)
Stack frame #07  pc 00030a8c  /system/lib/libdvm.so
Stack frame #08  pc 000342e4  /system/lib/libdvm.so
(_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
Stack frame #09  pc 0006cb62  /system/lib/libdvm.so
(_Z15dvmInvokeMethodP6ObjectPK6MethodP11ArrayObjectS5_P11ClassObjectb)
Stack frame #10  pc 00073fbe  /system/lib/libdvm.so
Stack frame #11  pc 00030a8c  /system/lib/libdvm.so
Stack frame #12  pc 000342e4  /system/lib/libdvm.so
(_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
Stack frame #13  pc 0006ce32  /system/lib/libdvm.so
(_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValueSt9__va_list)
Stack frame #14  pc 000553b6  /system/lib/libdvm.so
Stack frame #15  pc 00044d62  /system/lib/libandroid_runtime.so
Stack frame #16  pc 000458ca  /system/lib/libandroid_runtime.so
(_ZN7android14AndroidRuntime5startEPKcS2_)
Stack frame #17  pc 00008f0e  /system/bin/app_process
Stack frame #18  pc 0001672c  /system/lib/libc.so (__libc_init)

I think the stack trace may be connected with QSplashScreen, which is
displayed in main() function just after creating QApplication object. More
less it looks like:

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QSplashScreen splashScreen(QPixmap(":/splash.png"),
Qt::WindowStaysOnTopHint);
    splashScreen.showFullScreen();
    splashScreen.raise();
    app.processEvents();

    (...)

    return app.exec();
}

Maybe the issue is connected with
https://bugreports.qt-project.org/browse/QTBUG-14314? Or maybe there is a
bug in Java wrappers which (somehow) loaded the libraries and called the
main() function twice? (Not sure whether it's possible, I'm just trying to
figure out why those warnings "QApplication::exec: Must be called from the
main thread" were shown).

I'm still inspecting the issue, but maybe someone has any hints what could
went wrong?

Best regards,
Bartosz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20141215/6211532b/attachment.html>


More information about the Android-development mailing list