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

[self lee_theme_dealloc] EXC_BAD_ACCESS crash #27

Open
jerrywangjing opened this issue Dec 27, 2021 · 1 comment
Open

[self lee_theme_dealloc] EXC_BAD_ACCESS crash #27

jerrywangjing opened this issue Dec 27, 2021 · 1 comment

Comments

@jerrywangjing
Copy link

jerrywangjing commented Dec 27, 2021

在APP从后台切换到前台时,可能会造成app crash,通过异常断点查看,崩溃到的[self lee_theme_dealloc];这里,不太理解作者为什么在这里要多次递归调用该方法,可能引起crash的原因就是self(LEETheme)对象过度内存释放导致的,希望作者能修复该问题。谢谢。

下面是出现crash的文件,及代码片段:

文件:#import "LEETheme.h"

...

@implementation NSObject (LEEThemeConfigObject)
...

- (void)lee_theme_dealloc{
    
    if ([self isLeeTheme]) {
        
        [[NSNotificationCenter defaultCenter] removeObserver:self name:LEEThemeChangingNotificaiton object:nil];
        
        objc_removeAssociatedObjects(self);
    }
    [self lee_theme_dealloc];  // 注:crash 在这里
}
@lixiang1994
Copy link
Owner

实际上是交换了方法实现的, 并不是递归调用, [self lee_theme_dealloc]; 调用的是原来的方法实现, 崩溃到这里并不是由 LEETheme引起的.

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

No branches or pull requests

2 participants