Skip to content

Commit

Permalink
Fix: GLfps trigger the main thread checker in some case
Browse files Browse the repository at this point in the history
  • Loading branch information
haowenwu committed Jul 1, 2021
1 parent dbfad32 commit 7f60cfc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 14 additions & 2 deletions MTHawkeye/TimeConsumingPlugins/FPSTrace/Core/MTHFPSTrace.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,13 @@ - (MTHFPSGLRenderCounter *)getDynamicAttachGLESCounter:(id)target {
counter = [[MTHFPSGLRenderCounter alloc] init];
counter.identifier = [NSString stringWithFormat:@"%p", target];
}
[target setValue:counter forKey:propertyName];
if ([target isKindOfClass:[UIView class]] && ![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[target setValue:counter forKey:propertyName];
});
} else {
[target setValue:counter forKey:propertyName];
}
return counter;
}

Expand All @@ -288,7 +294,13 @@ - (MTHFPSGLRenderCounter *)getDynamicAttachGLESCounter:(id)target {

counter = [[MTHFPSGLRenderCounter alloc] init];
counter.identifier = [NSString stringWithFormat:@"%p", target];
[target setValue:counter forKey:propertyName];
if ([target isKindOfClass:[UIView class]] && ![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[target setValue:counter forKey:propertyName];
});
} else {
[target setValue:counter forKey:propertyName];
}
return counter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES"
enableUBSanitizer = "YES"
disableMainThreadChecker = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down

0 comments on commit 7f60cfc

Please sign in to comment.