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)
|
||||
{
|
||||
if (alphaTexture != nullptr) {
|
||||
this->_alphaTexture = alphaTexture;
|
||||
this->_alphaTexture->retain();
|
||||
this->_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
|
||||
alphaTexture->retain();
|
||||
CC_SAFE_RELEASE(_alphaTexture);
|
||||
_alphaTexture = alphaTexture;
|
||||
_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue