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
3.0.15.1 版本里的线程安全问题 #655
Comments
@kobe1941 崩溃日志能不能全一点哟? |
@kinarob 该有的都有了呀,崩溃类型SIGSEGV,具体所在的类和函数,只是bugly解析代码行数失败了 |
#pragma mark - 公共方法
+ (NSMutableArray *)properties
{
MJExtensionSemaphoreCreate
MJExtensionSemaphoreWait
NSMutableArray *cachedProperties = [self propertyDictForKey:&MJCachedPropertiesKey][NSStringFromClass(self)];
if (cachedProperties == nil) {
if (cachedProperties == nil) {
cachedProperties = [NSMutableArray array];
[self mj_enumerateClasses:^(__unsafe_unretained Class c, BOOL *stop) {
// 1.获得所有的成员变量
unsigned int outCount = 0;
objc_property_t *properties = class_copyPropertyList(c, &outCount);
// 2.遍历每一个成员变量
for (unsigned int i = 0; i<outCount; i++) {
MJProperty *property = [MJProperty cachedPropertyWithProperty:properties[i]];
// 过滤掉Foundation框架类里面的属性
if ([MJFoundation isClassFromFoundation:property.srcClass]) continue;
property.srcClass = c;
[property setOriginKey:[self propertyKey:property.name] forClass:self];
[property setObjectClassInArray:[self propertyObjectClassInArray:property.name] forClass:self];
[cachedProperties addObject:property];
}
// 3.释放内存
free(properties);
}];
[self propertyDictForKey:&MJCachedPropertiesKey][NSStringFromClass(self)] = cachedProperties;
}
}
MJExtensionSemaphoreSignal
return cachedProperties;
} |
@kobe1941 你改成这样的试一下? |
你把锁放到外围了,好的我试试看 @kinarob |
@kobe1941 你项目这个崩溃比例高吗? |
@kinarob 比较低,用最新版本的MJExtension,目前只看到一个崩溃日志上报,继续观察 |
@kinarob 你合并代码后,发新的版本,我后面直接集成新版本好了 |
@kobe1941 已经发布3.0.16的版本 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
用的最新的版本 3.0.15.1,依然有线程安全问题。
对应有问题的代码,大概在这里
The text was updated successfully, but these errors were encountered: