Skip to content

Commit

Permalink
Fixed memory leak at get_screen_data()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ordasto authored and not-fl3 committed Nov 5, 2023
1 parent 2d62c28 commit caf7ef2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,15 @@ pub fn get_screen_data() -> Image {

let context = get_context();

let texture = Texture2D::from_miniquad_texture(get_quad_context().new_render_texture(
miniquad::TextureParams {
width: context.screen_width as _,
height: context.screen_height as _,
..Default::default()
},
));
let texture_id = get_quad_context().new_render_texture(miniquad::TextureParams {
width: context.screen_width as _,
height: context.screen_height as _,
..Default::default()
});

let texture = Texture2D {
texture: context.textures.store_texture(texture_id),
};

texture.grab_screen();

Expand Down

0 comments on commit caf7ef2

Please sign in to comment.