mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
RenderTarget::set() forgets the texture; it's owned by the Renderer
By calling mem::forget() on the Texture, we're ensuring that said texture doesn't get dropped before RenderTarget::set() is finished.
This commit is contained in:
@@ -743,6 +743,7 @@ impl<'render_drawer> RenderTarget<'render_drawer> {
|
||||
pub fn set(&mut self, texture: Texture) -> SdlResult<()> {
|
||||
unsafe {
|
||||
if ll::SDL_SetRenderTarget(self.raw, texture.raw) == 0 {
|
||||
mem::forget(texture);
|
||||
Ok(())
|
||||
} else {
|
||||
Err(get_error())
|
||||
|
||||
Reference in New Issue
Block a user