summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2022-08-17 20:14:17 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-18 00:47:30 +0000
commit61a5220c77823dc2c638b7542ee6de948305bf62 (patch)
tree0046cc1a41b37382feac71ef259a1c62a4ce4780
parentacdeccdb981cba774848d9103cb8c965879bbf49 (diff)
downloadqtapplicationmanager-61a5220c77823dc2c638b7542ee6de948305bf62.tar.gz
Fix the internal IntentHandler map getting corrupted on closing apps
std::remove_if() on a QMap should result in a compile-time error, but it somehow doesn't. Instead the erase(remove_if()) algorithm leaves a corrupted QMap. This is especially noticeable in single-process mode, where the wrong intent handlers are being called after closing any single application, which registered IntentHandlers before. This bug was introduced while fixing clazy warnings. Change-Id: I144c051591ce8564e2653402d12bb926ef32eb76 Reviewed-by: Dominik Holland <dominik.holland@qt.io> (cherry picked from commit 4507e6f17c640d9e044a4b87ea4b84dda3c5b8ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/intent-client-lib/intentclient.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/intent-client-lib/intentclient.cpp b/src/intent-client-lib/intentclient.cpp
index ff495d4d..28af2a62 100644
--- a/src/intent-client-lib/intentclient.cpp
+++ b/src/intent-client-lib/intentclient.cpp
@@ -117,9 +117,7 @@ void IntentClient::registerHandler(IntentHandler *handler)
void IntentClient::unregisterHandler(IntentHandler *handler)
{
- m_handlers.erase(std::remove_if(m_handlers.begin(), m_handlers.end(),
- [handler](const auto &h) { return h == handler; }),
- m_handlers.end());
+ m_handlers.removeIf([handler](auto it) { return it.value() == handler; });
}
/*! \qmlmethod IntentRequest IntentClient::sendIntentRequest(string intentId, var parameters)