Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-34121

Crash in AttachedJNIEnv, potential crash in QJNIEnvironmentPrivate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.2.0 Alpha
    • QPA
    • None
    • Qt 5.0.2 on Android.
    • Android

      I am using Qt 5.0.2 (pre release) compiled from git. Qt is being linked into a daemon that is running as a Linux process inside of an Android device. It is compiled against bionic, and linked into an exe, and started by launchd. It is not loaded as a .so inside of a Dalvik VM.

      This means that JNI_OnLoad's are never run. So things they initialize are not done.

      In this context, if you try to use QSsl* objects from libQtNetwork.so, you get a crash in qsslsocket_openssl_android.cpp, when AttachedJNIEnv() does javaVM->GetEnv(). The solution is to skip the GetEnv when javaVM is NULL.

      Likewise, there are dangling NULL pointers in libQtCore.so which should be checked.

      The attached patch solved my crashes for me.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            jeffall Jeff Allen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes