From: Jay Freeman (saurik) Date: Wed, 8 Jan 2014 15:23:29 +0000 (-0800) Subject: On iOS 7, we can't always rely on libhide working. X-Git-Tag: v0.9.3912~28 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/e0c664750aae57e03651d9ad39ccd98b28ba1e38 On iOS 7, we can't always rely on libhide working. --- diff --git a/Settings.mm b/Settings.mm index 614a0b7..5f1ab8c 100644 --- a/Settings.mm +++ b/Settings.mm @@ -31,6 +31,7 @@ #include #include +static void *libhide; static BOOL (*IsIconHiddenDisplayId)(NSString *); static BOOL (*HideIconViaDisplayId)(NSString *); static BOOL (*UnHideIconViaDisplayId)(NSString *); @@ -423,7 +424,7 @@ static NSString *_plist; @implementation WBSettingsController + (void) load { - void *libhide(dlopen("/usr/lib/hide.dylib", RTLD_LAZY)); + libhide = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); IsIconHiddenDisplayId = reinterpret_cast(dlsym(libhide, "IsIconHiddenDisplayId")); HideIconViaDisplayId = reinterpret_cast(dlsym(libhide, "HideIconViaDisplayId")); UnHideIconViaDisplayId = reinterpret_cast(dlsym(libhide, "UnHideIconViaDisplayId")); @@ -446,7 +447,8 @@ static NSString *_plist; if ([_settings objectForKey:@"SummerBoard"] == nil) [_settings setObject:[NSNumber numberWithBool:set] forKey:@"SummerBoard"]; - [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"]; + if (libhide != NULL) + [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"]; } - (id) initForContentSize:(CGSize)size { @@ -471,7 +473,8 @@ static NSString *_plist; if (![data writeToFile:_plist options:NSAtomicWrite error:NULL]) return; - ([[_settings objectForKey:@"IconHidden"] boolValue] ? HideIconViaDisplayId : UnHideIconViaDisplayId)(WinterBoardDisplayID); + if (libhide != NULL) + ([[_settings objectForKey:@"IconHidden"] boolValue] ? HideIconViaDisplayId : UnHideIconViaDisplayId)(WinterBoardDisplayID); unlink("/User/Library/Caches/com.apple.springboard-imagecache-icons"); unlink("/User/Library/Caches/com.apple.springboard-imagecache-icons.plist");