Skip to content

Commit 17a9fd1

Browse files
authored
Merge pull request phaserjs#3961 from TadejZupancic/patch-12
RenderTexture: Texture is always destroyed
2 parents 3cc17f5 + bff7f99 commit 17a9fd1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/gameobjects/rendertexture/RenderTexture.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ var RenderTexture = new Class({
161161

162162
// Get the frame
163163
this.frame = this.texture.get();
164+
165+
this._saved = false;
164166

165167
/**
166168
* An internal Camera that can be used to move around the Render Texture.
@@ -350,6 +352,8 @@ var RenderTexture = new Class({
350352
saveTexture: function (key)
351353
{
352354
this.textureManager.renameTexture(this.texture.key, key);
355+
356+
this._saved = true;
353357

354358
return this.texture;
355359
},
@@ -835,7 +839,10 @@ var RenderTexture = new Class({
835839
this.renderer.deleteFramebuffer(this.framebuffer);
836840
}
837841

838-
this.texture.destroy();
842+
if (!this._saved)
843+
{
844+
this.texture.destroy();
845+
}
839846
}
840847

841848
});

0 commit comments

Comments
 (0)