Speculative fix for crash in ScreenMac
A crash can result from the following sequence of events (as debugged by ellyjones): 1. displays_require_update_ is false 2. The configure timer ticks, ConfigureTimerFired is called 3. ConfigureTimerFired -> UpdateDisplaysIfNeeded, which is a noop because displays_require_update_ is false 4. ConfigureTimerFired -> NotifyDisplaysChanged, which starts iterating the list 5. One instance of NativeWidgetNSWindowBridge:: OnDisplayMetricsChanged calls ScreenMac::GetDisplayNearestWindow 6. Since the display list has not yet been updated (at step 3), that falls back to GetCachedDisplayForScreen (and its call to UpdateDisplaysIfNeeded is a noop) 7. Since the display list still hasn't been updated, GetCachedDisplayForScreen calls OnNSScreensMayHaveChanged, which sets displays_require_update_ to true 8. The iteration from step 4 resumes, and another instance of NativeWidgetNSWindowBridge::OnDisplayMetricsChanged runs 9. For *this* instance, displays_require_update_ is true, so UpdateDisplaysIfNeeded destroys the old version of displays_ 10. The iteration from step 4 resumes, now iterating on a destroyed displays_. Break this by removing the call to OnNSScreensMayHaveChanged from GetCachedDisplayForScreen, to see if it removes the crashes. Bug: 1033866 Change-Id: I1271c83d5456ab9c863969842816661c6b3e0569 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135312Reviewed-by:Elly Fong-Jones <ellyjones@chromium.org> Commit-Queue: ccameron <ccameron@chromium.org> Cr-Commit-Position: refs/heads/master@{#756378}
Showing
Please register or sign in to comment