summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-03-13 11:41:49 +0100
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-03-16 14:03:18 +0000
commit5d34bf9033531264cfaa87c0259d331a2f07443b (patch)
treecb34bbd0d7039547bb18f7c90ce5ac903cd53046 /src/plugins
parentf901b75926127ff2ded6365e113b0cf17df22183 (diff)
Avoid deadlock on suspend/resume
On some devices, there is a possibility of getting a state change while we are locking the event loop for suspend. This is probably related to change 8c0ef140b3a7202c, but we should in any case use the existing deadlock protection mutex mechanism, just to make sure that there are not other cases which could trigger the same deadlock. Task-number: QTBUG-44339 Change-Id: I3e0b5fa2ddf4ef86e6b29cb1d67c4cccedd8242e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.cpp b/src/plugins/platforms/android/qandroideventdispatcher.cpp
index 2ba1399c6a..2348467722 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.cpp
+++ b/src/plugins/platforms/android/qandroideventdispatcher.cpp
@@ -33,6 +33,7 @@
#include "qandroideventdispatcher.h"
#include "androidjnimain.h"
+#include "androiddeadlockprotector.h"
QAndroidEventDispatcher::QAndroidEventDispatcher(QObject *parent) :
QUnixEventDispatcherQPA(parent)
@@ -78,11 +79,13 @@ void QAndroidEventDispatcher::goingToStop(bool stop)
int QAndroidEventDispatcher::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timespec *timeout)
{
- if (m_stopRequest.testAndSetAcquire(StopRequest, Stopping)) {
- m_semaphore.acquire();
- wakeUp();
+ {
+ AndroidDeadlockProtector protector;
+ if (protector.acquire() && m_stopRequest.testAndSetAcquire(StopRequest, Stopping)) {
+ m_semaphore.acquire();
+ wakeUp();
+ }
}
-
return QUnixEventDispatcherQPA::select(nfds, readfds, writefds, exceptfds, timeout);
}