Android: Fix crash at shutdown when keyboard is visible

This is a follow-up to 4c6ebe5f9e.
Crash was still 100% reproducible for me with the previous fix.

Task-number: QTBUG-40957
Change-Id: Ie59cfe4f1fc746251fe06ba96369738098b2a35f
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Sérgio Martins 2014-08-27 23:06:48 +01:00 committed by Paul Olav Tvete
parent 41826cfbae
commit 5a278dd42a

View File

@ -47,6 +47,7 @@
#include <QTouchEvent>
#include <QPointer>
#include <QGuiApplication>
#include <QDebug>
QT_BEGIN_NAMESPACE
@ -716,7 +717,7 @@ namespace QtAndroidInput
static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/)
{
QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
if (inputContext)
if (inputContext && qGuiApp)
inputContext->emitInputPanelVisibleChanged();
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext;