Avoid deadlock when suspending app at startup
QWindowSystemInterface::flushWindowSystemEvents() is a synchronous call. This will cause a deadlock if the GUI thread is waiting for an OpenGL surface at the same time. Add deadlock protection to this case as well. Task-number: QTBUG-44721 Change-Id: Id26370f6e07011dbcd861617bf96f59e85837db6 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
parent
2002103baa
commit
156be54578
@ -42,6 +42,7 @@
|
||||
#include "androidjniinput.h"
|
||||
#include "androidjniclipboard.h"
|
||||
#include "androidjnimenu.h"
|
||||
#include "androiddeadlockprotector.h"
|
||||
#include "qandroidplatformdialoghelpers.h"
|
||||
#include "qandroidplatformintegration.h"
|
||||
#include "qandroidassetsfileenginehandler.h"
|
||||
@ -604,7 +605,11 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state
|
||||
QAndroidEventDispatcherStopper::instance()->goingToStop(true);
|
||||
QCoreApplication::processEvents();
|
||||
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state));
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
{
|
||||
AndroidDeadlockProtector protector;
|
||||
if (protector.acquire())
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
}
|
||||
if (state == Qt::ApplicationSuspended)
|
||||
QAndroidEventDispatcherStopper::instance()->stopAll();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user