Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Test Case: UIButton::loadTextureNormal 2nd time error #18611

Open
wants to merge 5 commits into
base: v3
Choose a base branch
from

Conversation

peerobo
Copy link

@peerobo peerobo commented Jan 5, 2018

Test case for this issue
#18609

@drelaptop
Copy link
Contributor

You said fixing this issue need to modify UIButton.cpp in #18609, however I didn't see the change about that on Files Changed, is it a mistake?

@peerobo
Copy link
Author

peerobo commented Jan 5, 2018

I thought you wanted a test case to see what was the error. I will commit my temporary fix later.

@drelaptop
Copy link
Contributor

please see CI log to solve the checks failed @peerobo

@peerobo
Copy link
Author

peerobo commented Jan 8, 2018

@drelaptop please check my fix if you have time. Thanks.

_buttonDisabledRenderer->initWithSpriteFrameName(disabled);
// _buttonDisabledRenderer->initWithSpriteFrameName(disabled);
frm = SpriteFrameCache::getInstance()->getSpriteFrameByName(disabled);
_buttonDisabledRenderer->setSpriteFrame(frm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm the issue existed, we need fix it. do you know why it happened? I am not sure this way fixing the bug is best.

one reason is in initWithSpriteFrameName called SpriteFrameCache::getInstance()->getSpriteFrameByName(disabled);, setSpriteFrame and the other method, so I think the bug is caused due to internal of initWithSpriteFrameName.

another reason is initWithSpriteFrameName do many checks, calling getSpriteFrameByName and setSpriteFrame directly do no checks, if I code:

spr->loadTextureNormal("Not Existed Texture", ui::Widget::TextureResType::PLIST);

the app will crash.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the issue is within initWithSpriteFrameName() but I do not have time right now to debug. This is a temporary fix to make my project work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understand, and I am doing something about cmake firstly, so let it stay here for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants