mirror of https://github.com/axmolengine/axmol.git
Fix memory leak if invoking Texture2D::setAlphaTexture many times. (#19590)
This commit is contained in:
parent
195dc704e3
commit
bc1483dca7
|
@ -897,9 +897,10 @@ void Texture2D::removeSpriteFrameCapInset(SpriteFrame* spriteFrame)
|
||||||
void Texture2D::setAlphaTexture(Texture2D* alphaTexture)
|
void Texture2D::setAlphaTexture(Texture2D* alphaTexture)
|
||||||
{
|
{
|
||||||
if (alphaTexture != nullptr) {
|
if (alphaTexture != nullptr) {
|
||||||
this->_alphaTexture = alphaTexture;
|
alphaTexture->retain();
|
||||||
this->_alphaTexture->retain();
|
CC_SAFE_RELEASE(_alphaTexture);
|
||||||
this->_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
|
_alphaTexture = alphaTexture;
|
||||||
|
_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue