File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -39,16 +39,23 @@ + (instancetype)sharedSettings
39
39
{
40
40
static dispatch_once_t onceToken;
41
41
static OCClassSettings *sharedClassSettings = nil ;
42
-
42
+ __block BOOL addDefaultSources = NO ;
43
+
43
44
dispatch_once (&onceToken, ^{
44
45
sharedClassSettings = [OCClassSettings new ];
46
+ addDefaultSources = YES ;
47
+ });
45
48
49
+ if (addDefaultSources)
50
+ {
51
+ // Add sources outside dispatch_once, so that calling OCLog / OCClassSettings.sharedSettings will not
52
+ // lead to a crash due to a call of dispatch_once from within the same dispatch_once
46
53
[sharedClassSettings addSource: [OCClassSettingsFlatSourceManagedConfiguration new ]];
47
54
[sharedClassSettings addSource: [OCClassSettingsUserPreferences sharedUserPreferences ]];
48
55
[sharedClassSettings addSource: [OCClassSettingsFlatSourcePostBuild sharedPostBuildSettings ]];
49
56
[sharedClassSettings addSource: [[OCClassSettingsFlatSourceEnvironment alloc ] initWithPrefix: @" oc:" ]];
50
- });
51
-
57
+ }
58
+
52
59
return (sharedClassSettings);
53
60
}
54
61
You can’t perform that action at this time.
0 commit comments