Commit f1640db8ce52ac03e84de2108a3df3f36c4c1977

John Stiles 2022-05-10T11:13:48

Fix crash when calling certain gl APIs before initialization. ANGLE attempts to report an error if various APIs (incl. glClearStencil) are used before the context is set up. On Mac, when ANGLE attempts to report the error, if the egl platform is still uninitialized, it attempts to access NULL thread information via GenerateContextLostErrorOnCurrentGlobalContext. This leads to an assertion/crash. We can guard against this by calling egl::GetCurrentThread() first, which will do the lazy-initialization work that is needed. If egl is already initialized, this is harmless and very inexpensive. Bug: angleproject:7290 Change-Id: Iadc89dba52f8da1dff17610099a0c0a38d947571 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3638982 Reviewed-by: Jamie Madill <jmadill@chromium.org> Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>