summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2022-08-17 20:14:17 +0200
committerRobert Griebl <robert.griebl@qt.io>2022-08-17 21:43:07 +0200
commit4507e6f17c640d9e044a4b87ea4b84dda3c5b8ad (patch)
tree65a5872166b3632b5a26cecec98e2057143b4913
parent89de1a4c5a680366523f7bba1d18ca2d84d2a565 (diff)
downloadqtapplicationmanager-4507e6f17c640d9e044a4b87ea4b84dda3c5b8ad.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 Pick-to: 6.4 6.3 6.2 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-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 d8d01835..17f2ac25 100644
--- a/src/intent-client-lib/intentclient.cpp
+++ b/src/intent-client-lib/intentclient.cpp
@@ -116,9 +116,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)