jezzmemo / JJException

Protect the objective-c application(保护App不闪退)
MIT License
1.62k stars 267 forks source link

NSMutableDictionary赋值野指针闪退 #128

Open ZHDeveloper opened 2 years ago

ZHDeveloper commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

NSMutableDictionary赋值野指针闪退

To Reproduce Steps to reproduce the behavior:

NSMutableDictionary *dict = [NSMutableDictionary dictionary];

__unsafe_unretained UIView *testObj = [[UIView alloc] init];
NSLog(@"testObj 指针指向的地址:%p 指针本身的地址:%p", testObj, &testObj);

dict[@"8888"] = testObj;
截屏2022-07-25 下午4 01 07

Please complete the following information

jezzmemo commented 2 years ago

正常使用API也有这种问题吧,这种问题不是JJException的范畴

ZHDeveloper commented 2 years ago

这种闪退能避免吗?

jezzmemo commented 2 years ago

OC技术上是可行的,大概原理,先要定位是哪里野指针了,然后将野指针的对象dealloc置换,不让它真正释放,到Swift就很难了