Fix panic in Webrender during shutdown (#32897)

* Fix panic in webrender during shutdown

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Pass webgl_threads_sender to WebGLThreads::exit

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* follow the naming convention and use sender instead of webgl_threads_sender

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Avoid deadlock when webgl_threads is None

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Use tuple matching for webgl_threads and webgl_threads_receiver

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove unused _webgl_threads_sender

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2024-08-06 12:01:33 +02:00 committed by GitHub
parent 28430bad0e
commit 3800922cde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 13 deletions

View file

@ -2644,6 +2644,7 @@ where
ipc::channel().expect("Failed to create IPC channel!");
let (storage_ipc_sender, storage_ipc_receiver) =
ipc::channel().expect("Failed to create IPC channel!");
let mut webgl_threads_receiver = None;
debug!("Exiting core resource threads.");
if let Err(e) = self
@ -2710,9 +2711,12 @@ where
}
if let Some(webgl_threads) = self.webgl_threads.as_ref() {
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
webgl_threads_receiver = Some(receiver);
debug!("Exiting WebGL thread.");
if let Err(e) = webgl_threads.exit() {
warn!("Exit WebGL Thread failed ({})", e);
if let Err(e) = webgl_threads.exit(sender) {
warn!("Exit WebGL Thread failed ({e})");
}
}
@ -2733,6 +2737,14 @@ where
if let Err(e) = storage_ipc_receiver.recv() {
warn!("Exit storage thread failed ({:?})", e);
}
if self.webgl_threads.is_some() {
if let Err(e) = webgl_threads_receiver
.expect("webgl_threads_receiver to be Some")
.recv()
{
warn!("Exit WebGL thread failed ({:?})", e);
}
}
debug!("Asking compositor to complete shutdown.");
self.compositor_proxy.send(CompositorMsg::ShutdownComplete);