Commit 5005dd00 authored by Mohammad Refaat's avatar Mohammad Refaat Committed by Commit Bot

Fix a potential crash that can happen if a weak ptr was deallocated.

OverlayUIDidFinishPresentation is called from a weakptr, which can be nil
and it's not checked. If the weakptr is nil the call is crash as it's
called from a C++ object.

Change-Id: Idf9a6a73aded75d411e92e35a97a07a2db04b8df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795890Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Mohammad Refaat <mrefaat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695708}
parent a633586e
......@@ -75,8 +75,11 @@
presentViewController:self.alertViewController
animated:animated
completion:^{
weakSelf.delegate->OverlayUIDidFinishPresentation(
weakSelf.request);
__typeof__(self) strongSelf = weakSelf;
if (!strongSelf)
return;
strongSelf.delegate->OverlayUIDidFinishPresentation(
strongSelf.request);
}];
self.started = YES;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment