fix: On close trying to remove observer from an empty collection leads to an access violation (#15739)
This commit is contained in:
parent
e12c0dcf66
commit
b97d7e7ecd
1 changed files with 3 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue