We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d7d69fa commit d377aa8Copy full SHA for d377aa8
1 file changed
cefpython/cef3/subprocess/javascript_callback.cpp
@@ -85,10 +85,17 @@ void RemoveJavascriptCallbacksForFrame(CefRefPtr<CefFrame> frame) {
85
int64 frameId = frame->GetIdentifier();
86
while (it != g_jsCallbackMap.end()) {
87
if (it->second.first->GetIdentifier() == frameId) {
88
- g_jsCallbackMap.erase(it);
+ // 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++);
95
DebugLog("Renderer: RemoveJavascriptCallbacksForFrame(): " \
96
"removed js callback from the map");
97
+ } else {
98
+ ++it;
99
}
- ++it;
100
101
0 commit comments