From 5e35e6c63582546c77fa2cfd5384ffdf39bdf46f Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Sun, 28 Feb 2021 22:38:09 +0100 Subject: [PATCH] Clear script ids in RemoveAllUserScripts() --- src/msw/webview_edge.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp index f464e3619e..8d7baddb69 100644 --- a/src/msw/webview_edge.cpp +++ b/src/msw/webview_edge.cpp @@ -887,13 +887,13 @@ bool wxWebViewEdge::AddUserScript(const wxString& javascript, void wxWebViewEdge::RemoveAllUserScripts() { m_impl->m_pendingUserScripts.clear(); - for (wxVector::iterator it = m_impl->m_userScriptIds.begin(); - it != m_impl->m_userScriptIds.end(); ++it) + for (auto& scriptId : m_impl->m_userScriptIds) { - HRESULT hr = m_impl->m_webView->RemoveScriptToExecuteOnDocumentCreated(it->wc_str()); + HRESULT hr = m_impl->m_webView->RemoveScriptToExecuteOnDocumentCreated(scriptId.wc_str()); if (FAILED(hr)) wxLogApiError("RemoveScriptToExecuteOnDocumentCreated", hr); } + m_impl->m_userScriptIds.clear(); } void wxWebViewEdge::RegisterHandler(wxSharedPtr handler)