mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
canvas: Send CanvasClose to canvas thread from canvas state (#38315)
Currently we only closed `CanvasRenderingContext2D` (and `OffscreenCanvasRenderingContext2D` because it wraps `CanvasRenderingContext2D`), but we didn't close last consumer of `CanvasState` which is `PaintRenderingContext`. To prevent any future leaks, let's just send `CanvasClose` in `CanvasState` drop. Testing: Existing WPT tests --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
213b532712
commit
d410236c87
2 changed files with 10 additions and 29 deletions
|
@ -259,10 +259,6 @@ impl CanvasState {
|
|||
})
|
||||
}
|
||||
|
||||
pub(crate) fn get_ipc_renderer(&self) -> &IpcSender<CanvasMsg> {
|
||||
&self.ipc_renderer
|
||||
}
|
||||
|
||||
pub(crate) fn image_key(&self) -> ImageKey {
|
||||
self.image_key
|
||||
}
|
||||
|
@ -2197,6 +2193,14 @@ impl CanvasState {
|
|||
}
|
||||
}
|
||||
|
||||
impl Drop for CanvasState {
|
||||
fn drop(&mut self) {
|
||||
if let Err(err) = self.ipc_renderer.send(CanvasMsg::Close(self.canvas_id)) {
|
||||
warn!("Could not close canvas: {}", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_color(
|
||||
canvas: Option<&HTMLCanvasElement>,
|
||||
string: &str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue