]> git.saurik.com Git - cydia.git/commitdiff
Make root->mobile preference shift exception-safe.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 25 May 2014 09:39:39 +0000 (02:39 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 25 May 2014 09:39:39 +0000 (02:39 -0700)
MobileCydia.mm

index 5c081bd68c8dfc8ec60ff5c04b2a7f30d6fa7f1c..10f2de8ceef4531f9468055b6849b21a3fec3f68 100644 (file)
@@ -9903,10 +9903,15 @@ Class $CFXPreferencesPropertyListSource;
 MSHook(BOOL, CFXPreferencesPropertyListSource$_backingPlistChangedSinceLastSync, CFXPreferencesPropertyListSource *self, SEL _cmd) {
     NSURL *&url(MSHookIvar<NSURL *>(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<NSURL *>(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;
 }