diff options
-rw-r--r-- | components/canvas/canvas_paint_thread.rs | 8 | ||||
-rw-r--r-- | components/canvas/webgl_paint_thread.rs | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index 28a1e46e7b6..23989a45f18 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -706,6 +706,14 @@ impl<'a> CanvasPaintThread<'a> { } } +impl<'a> Drop for CanvasPaintThread<'a> { + fn drop(&mut self) { + if let Some(ref mut wr) = self.webrender_api { + wr.delete_image(self.webrender_image_key.unwrap()); + } + } +} + /// Used by drawImage to get rid of the extra pixels of the image data that /// won't be copied to the canvas /// image_data: Color pixel data of the image diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index 5c71df5cbe5..8b1ff8ff753 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -195,3 +195,11 @@ impl WebGLPaintThread { } } } + +impl Drop for WebGLPaintThread { + fn drop(&mut self) { + if let WebGLPaintTaskData::Readback(_, Some((ref mut wr, image_key))) = self.data { + wr.delete_image(image_key); + } + } +} |