-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Description
- cocos2d-x version: 3.17
- devices test on: simulator
- developing environments
- NDK version:
- Xcode version: 9.2
- VS version:
- browser type and version:
Steps to Reproduce:
UIButton appears to be leaking memory for me. More specifically _titleRenderer’s retain in Button::setTitleLabel() doesn’t have a matching release.
Removing the retain from Button::setTitleLabel() fixes the leak.
Is there a reason retain is being called on _titleRenderer even though it’s being added as a child?
void Button::setTitleLabel(Label* label)
{
if (_titleRenderer != label) {
CC_SAFE_RELEASE(_titleRenderer);
_titleRenderer = label;
CC_SAFE_RETAIN(_titleRenderer);
addProtectedChild(_titleRenderer, TITLE_RENDERER_Z, -1);
updateTitleLocation();
}
}