From 28d9b32a5ec50a459b03fc06ce95f9a97df0439e Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 25 May 2014 02:39:39 -0700 Subject: Make root->mobile preference shift exception-safe. --- MobileCydia.mm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index 5c081bd..10f2de8 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -9903,10 +9903,15 @@ Class $CFXPreferencesPropertyListSource; MSHook(BOOL, CFXPreferencesPropertyListSource$_backingPlistChangedSinceLastSync, CFXPreferencesPropertyListSource *self, SEL _cmd) { NSURL *&url(MSHookIvar(self, "_url")), *old(url); NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); + url = MobilizeURL(url); - BOOL value(_CFXPreferencesPropertyListSource$_backingPlistChangedSinceLastSync(self, _cmd)); - //NSLog(@"%@ %s", [url absoluteString], value ? "YES" : "NO"); - url = old; + BOOL value; @try { + value = _CFXPreferencesPropertyListSource$_backingPlistChangedSinceLastSync(self, _cmd); + //NSLog(@"CFX %@ %s", [url absoluteString], value ? "YES" : "NO"); + } @finally { + url = old; + } + [pool release]; return value; } @@ -9914,10 +9919,15 @@ MSHook(BOOL, CFXPreferencesPropertyListSource$_backingPlistChangedSinceLastSync, MSHook(void *, CFXPreferencesPropertyListSource$createPlistFromDisk, CFXPreferencesPropertyListSource *self, SEL _cmd) { NSURL *&url(MSHookIvar(self, "_url")), *old(url); NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); + url = MobilizeURL(url); - void *value(_CFXPreferencesPropertyListSource$createPlistFromDisk(self, _cmd)); - //NSLog(@"%@ %@", [url absoluteString], value); - url = old; + void *value; @try { + value = _CFXPreferencesPropertyListSource$createPlistFromDisk(self, _cmd); + //NSLog(@"CFX %@ %@", [url absoluteString], value); + } @finally { + url = old; + } + [pool release]; return value; } -- cgit v1.2.3