Skip to content

Commit 137f97b

Browse files
committed
RenderTexture.destroy has been renamed to preDestroy to take advantage of the preDestroy callback system.
1 parent 0893c15 commit 137f97b

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

src/gameobjects/rendertexture/RenderTexture.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,6 @@ var RenderTexture = new Class({
135135
this.initPipeline('TextureTintPipeline');
136136
},
137137

138-
/**
139-
* [description]
140-
*
141-
* @method Phaser.GameObjects.RenderTexture#destroy
142-
* @since 3.2.0
143-
*/
144-
destroy: function ()
145-
{
146-
GameObject.prototype.destroy.call(this);
147-
148-
if (this.renderer.type === CONST.WEBGL)
149-
{
150-
this.renderer.deleteTexture(this.texture);
151-
this.renderer.deleteFramebuffer(this.framebuffer);
152-
}
153-
},
154-
155138
/**
156139
* [description]
157140
*
@@ -184,6 +167,22 @@ var RenderTexture = new Class({
184167
this.globalAlpha = alpha;
185168

186169
return this;
170+
},
171+
172+
/**
173+
* Internal destroy handler, called as part of the destroy process.
174+
*
175+
* @method Phaser.GameObjects.RenderTexture#preDestroy
176+
* @protected
177+
* @since 3.9.0
178+
*/
179+
preDestroy: function ()
180+
{
181+
if (this.renderer && this.renderer.gl)
182+
{
183+
this.renderer.deleteTexture(this.texture);
184+
this.renderer.deleteFramebuffer(this.framebuffer);
185+
}
187186
}
188187

189188
/**

0 commit comments

Comments
 (0)