Fix end2end intermittent crash on macOS if custom OSWindow is used.

In MultisammpleTest, a custom OSWindow object is created. Sometimes this
window's internal Objective-C window object is not released after the
test finishes, thus input events such as mouse/keyboard are still
forwarded to this window. However its content view is already released
causing the crash.

call [mWindow setContentView:nil] inside OSXWindow::destroy() seems to
fix this bug.

Bug: angleproject:4815
Change-Id: If00398ff0082624ade5e8be8ad3b0f91d17c23ed
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2281782
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Le Hoang Quyen 2020-07-06 01:36:32 +08:00 коммит произвёл Commit Bot
Родитель b8583bcc95
Коммит 10ef43ce50
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -685,6 +685,8 @@ void OSXWindow::destroy()
[mDelegate onOSXWindowDeleted];
[mDelegate release];
mDelegate = nil;
// NSWindow won't be completely released unless its content view is set to nil:
[mWindow setContentView:nil];
[mWindow release];
mWindow = nil;
}