mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: On close trying to remove observer from an empty collection leads to an access violation (#15739)
This commit is contained in:
committed by
John Kleinschmidt
parent
e12c0dcf66
commit
b97d7e7ecd
@@ -298,7 +298,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||
observers_.AddObserver(obs);
|
||||
}
|
||||
void RemoveObserver(ExtendedWebContentsObserver* obs) {
|
||||
observers_.RemoveObserver(obs);
|
||||
// Trying to remove from an empty collection leads to an access violation
|
||||
if (observers_.might_have_observers())
|
||||
observers_.RemoveObserver(obs);
|
||||
}
|
||||
|
||||
bool EmitNavigationEvent(const std::string& event,
|
||||
|
||||
Reference in New Issue
Block a user