fix: ensure modeL_ exists before calling delegate methods (#20111)
This is a speculative fix for a crash we are seeing in `menuDidClose`. We can't repro the crash but the traces have it happening in this method and just by reading through the impl the only part that jumps out as Might Crash is this `model_` call. Other methods in the menu controller check `model_` before using it so it probably makes sense to do that here as well.
This commit is contained in:
parent
65ebb6e547
commit
8b523cf88a
1 changed files with 2 additions and 1 deletions
|
@ -375,7 +375,8 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
|||
- (void)menuDidClose:(NSMenu*)menu {
|
||||
if (isMenuOpen_) {
|
||||
isMenuOpen_ = NO;
|
||||
model_->MenuWillClose();
|
||||
if (model_)
|
||||
model_->MenuWillClose();
|
||||
// Post async task so that itemSelected runs before the close callback
|
||||
// deletes the controller from the map which deallocates it
|
||||
if (!closeCallback.is_null()) {
|
||||
|
|
Loading…
Reference in a new issue