path: root/src/corelib/kernel/qjnihelpers.cpp
diff options
authorHeikki Haveri <>2017-11-29 12:57:28 +0200
committerBogDan Vatra <>2017-12-12 20:12:49 +0000
commite55c7974db42a2c5bc5e6a8a1ef88ea5602ae266 (patch)
treee09dbe2f6d0a7b19e2271376c56cc2151ef6cc06 /src/corelib/kernel/qjnihelpers.cpp
parent48d677365a1061aa973b38d7b640498830bda452 (diff)
Fix Android Service thread getting stuck in service startup
This change allows services using QAndroidService to function properly. A service using a plain QCoreApplication is still affected. The original code uses postfix decrement, causing an off-by-one error in reference counting, which, in turn, fails to properly release a semaphore. Fix by using deref() instead, which is also more readable, and consistent with the use of ref() elsewhere in the code. Task-number: QTBUG-64728 Change-Id: I99b59307638d619506c594f86de6d7d202d755f2 Reviewed-by: Marc Mutz <> Reviewed-by: BogDan Vatra <>
Diffstat (limited to 'src/corelib/kernel/qjnihelpers.cpp')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index 02c58858ff..0d7c143999 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -592,7 +592,7 @@ void QtAndroidPrivate::setOnBindListener(QtAndroidPrivate::OnBindListener *liste
QMutexLocker lock(g_onBindListenerMutex);
*g_onBindListener = listener;
- if (!(*g_serviceSetupLockers)--)
+ if (!g_serviceSetupLockers->deref())