Update MBProgressHUD.m #192

Merged
merged 1 commit into from Feb 25, 2014

Conversation

Projects
None yet
2 participants
Contributor

liuyaodong commented Feb 25, 2014

Cancel scheduled task when -done called to fix memory issues.

@liuyaodong liuyaodong Update MBProgressHUD.m
Cancel scheduled task when -done called to fix memory issues.
307ca57
Collaborator

matej commented Feb 25, 2014

Could you elaborate more on what's the problem here?

Contributor

liuyaodong commented Feb 25, 2014

I use - (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay; to hide MBProgressHUD after, say, 15 seconds in my app. When I got a memory warning, in which case I want to purge my data immediately, I tried removing HUD from superview and releasing it. However, the -dealloc message doesn't come instantly but after several seconds. It seems like the system will hold the reference to the HUD under scheduled until it's done. So I tried canceling the scheduled task in the -done method and it works. The HUD will be dealloc right after it's removed from superview and released.
I'm not a native English speaker and this is my first time to do a pull request in GitHub, I beg I haven't done something wrong and I'm just trying my best to help. :)

matej merged commit 130d312 into jdg:master Feb 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment