From 25b20ebfc650013140fce9e8943e4405d77de1a6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 29 Jul 2019 08:15:59 -0400 Subject: [PATCH] Drop webgl main thread data during shutdown. --- components/canvas/webgl_thread.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index f2099094127..faea8e76d1c 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -112,12 +112,14 @@ impl WebGLMainThread { // Any context could be current when we start. self.thread_data.borrow_mut().bound_context_id = None; - self.shut_down.set( - !self - .thread_data - .borrow_mut() - .process(EventLoop::Nonblocking), - ); + let result = self + .thread_data + .borrow_mut() + .process(EventLoop::Nonblocking); + if !result { + self.shut_down.set(true); + WEBGL_MAIN_THREAD.with(|thread_data| thread_data.borrow_mut().take()); + } } /// Returns the main GL thread if called from the main thread,