Fix crash on boot =/ (#1349)

I botched a migration 6 months ago, which left some lingering TSRecipients serialized in our data store, laying in wait to explode the next time we enumerate every object in the database (e.g. when we add an index).

The bloom filter migration failed to remove TSRecipients in the somewhat rare event that the local user had no downloaded bloom filters. This could happen e.g. if they were low on disk space at the time of running the migration, I believe the app would remove the bloom filter cache.

// FREEBIE
pull/1/head
Michael Kirk 8 years ago committed by GitHub
parent 14570cb6cf
commit 1433ee2655

@ -130,7 +130,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS: CHECKOUT OPTIONS:
SignalServiceKit: SignalServiceKit:
:commit: 2dba7d141a4840eb96c1482e0dd2db11a854e6a3 :commit: 1098bc203e4ca2d7ae444b5a6e913b123455c5da
:git: https://github.com/WhisperSystems/SignalServiceKit.git :git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket: SocketRocket:
:commit: 8096fef47d582bff8ae3758c9ae7af1d55ea53d6 :commit: 8096fef47d582bff8ae3758c9ae7af1d55ea53d6

@ -21,7 +21,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.5.1</string> <string>2.5.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -38,7 +38,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2.5.1.0</string> <string>2.5.2.2</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LOGS_EMAIL</key> <key>LOGS_EMAIL</key>

@ -60,8 +60,6 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} }
[Environment.getCurrent initCallListener]; [Environment.getCurrent initCallListener];
[self setupTSKitEnv];
BOOL loggingIsEnabled; BOOL loggingIsEnabled;
#ifdef DEBUG #ifdef DEBUG
@ -78,6 +76,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[DebugLogger.sharedLogger enableFileLogging]; [DebugLogger.sharedLogger enableFileLogging];
} }
[self setupTSKitEnv];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:kStoryboardName bundle:[NSBundle mainBundle]]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:kStoryboardName bundle:[NSBundle mainBundle]];
UIViewController *viewController = UIViewController *viewController =
[storyboard instantiateViewControllerWithIdentifier:kInitialViewControllerIdentifier]; [storyboard instantiateViewControllerWithIdentifier:kInitialViewControllerIdentifier];

@ -75,6 +75,14 @@
}); });
} }
if ([self isVersion:previousVersion atLeast:@"2.0.0" andLessThan:@"2.5.2"] && [TSAccountManager isRegistered]) {
[[TSStorageManager sharedManager].dbConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
NSUInteger legacyRecipientCount = [transaction numberOfKeysInCollection:@"TSRecipient"];
DDLogWarn(@"Removing %lu objects from TSRecipient collection", (unsigned long)legacyRecipientCount);
[transaction removeAllObjectsInCollection:@"TSRecipient"];
}];
}
[Environment.preferences setAndGetCurrentVersion]; [Environment.preferences setAndGetCurrentVersion];
} }

Loading…
Cancel
Save