Exit Canvas paint thread on shutdown

This commit is contained in:
Paul Rouget 2018-10-29 11:05:19 +01:00
parent b19f9d9c5b
commit cdf22c1493
3 changed files with 7 additions and 0 deletions

View file

@ -66,6 +66,7 @@ impl<'a> CanvasPaintThread <'a> {
} }
} }
}, },
CanvasMsg::Exit => break,
} }
}, },
Err(e) => { Err(e) => {

View file

@ -27,6 +27,7 @@ pub enum CanvasMsg {
FromScript(FromScriptMsg, CanvasId), FromScript(FromScriptMsg, CanvasId),
Recreate(Size2D<u32>, CanvasId), Recreate(Size2D<u32>, CanvasId),
Close(CanvasId), Close(CanvasId),
Exit,
} }
#[derive(Clone, Deserialize, Serialize)] #[derive(Clone, Deserialize, Serialize)]

View file

@ -1441,6 +1441,11 @@ where
} }
} }
debug!("Exiting Canvas Paint thread.");
if let Err(e) = self.canvas_chan.send(CanvasMsg::Exit) {
warn!("Exit Canvas Paint thread failed ({})", e);
}
if let Some(webgl_threads) = self.webgl_threads.as_ref() { if let Some(webgl_threads) = self.webgl_threads.as_ref() {
debug!("Exiting WebGL thread."); debug!("Exiting WebGL thread.");
if let Err(e) = webgl_threads.exit() { if let Err(e) = webgl_threads.exit() {