summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-15 14:35:00 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-15 17:05:26 +0000
commit50c423267ee54020a7ddbe3a0f56ddca4653c40a (patch)
tree387e1cc9fdaa927e74f5a02e17cafcce18a252fe /src
parent7b2cbb3e9dae2080c76f8858daa3743f3e7aac1d (diff)
Fix crash in BrowserContextAdapter::removeCustomUrlSchemeHandler
Do not cache the end iterator, because erase might invalidate it. Do not increment the iterator in the erase case. Change-Id: I1cbad04fdaaf1bf4cfae252bb7569d817b6ab5a5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_adapter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index a6d3dfa4d..4aa34e5d6 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -361,13 +361,13 @@ bool BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHand
{
bool removedOneOrMore = false;
auto it = m_customUrlSchemeHandlers.begin();
- auto end = m_customUrlSchemeHandlers.end();
- for (; it != end; ++it) {
+ while (it != m_customUrlSchemeHandlers.end()) {
if (it.value() == handler) {
it = m_customUrlSchemeHandlers.erase(it);
removedOneOrMore = true;
continue;
}
+ ++it;
}
if (removedOneOrMore)
updateCustomUrlSchemeHandlers();