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:
Dan Spencer
2015-02-13 12:54:44 -07:00
parent 778362c912
commit 036be4e824
+1
View File
@@ -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())