diff options
author | Robert Griebl <robert.griebl@qt.io> | 2022-08-17 20:14:17 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-18 00:47:30 +0000 |
commit | 0bca49a007d60413fa82f3eca132f6d2600220f7 (patch) | |
tree | 9410d1b03beabccdd9d620d667c5e26d869c3e41 | |
parent | 28043843fb02b5581efe43d69492cd5cd909e765 (diff) | |
download | qtapplicationmanager-0bca49a007d60413fa82f3eca132f6d2600220f7.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.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/intent-client-lib/intentclient.cpp b/src/intent-client-lib/intentclient.cpp index 08fbd92f..1148fbb9 100644 --- a/src/intent-client-lib/intentclient.cpp +++ b/src/intent-client-lib/intentclient.cpp @@ -143,9 +143,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) |