File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
cefpython/cef3/subprocess Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,17 @@ void RemoveJavascriptCallbacksForFrame(CefRefPtr<CefFrame> frame) {
8585 int64 frameId = frame->GetIdentifier ();
8686 while (it != g_jsCallbackMap.end ()) {
8787 if (it->second .first ->GetIdentifier () == frameId) {
88- g_jsCallbackMap.erase (it);
88+ // Pass current iterator and increment it after passing
89+ // to the function, but before erase() is called, this
90+ // is important for it to work in a loop. You can't do this:
91+ // | if (..) erase(it);
92+ // | ++it;
93+ // This would cause an infinite loop.
94+ g_jsCallbackMap.erase (it++);
8995 DebugLog (" Renderer: RemoveJavascriptCallbacksForFrame(): " \
9096 " removed js callback from the map" );
97+ } else {
98+ ++it;
9199 }
92- ++it;
93100 }
94101}
You can’t perform that action at this time.
0 commit comments