Add logging around 'SAE to same thread' crash.

pull/1/head
Matthew Chen 7 years ago
parent 56e3ff14fe
commit eee2f7c8c6

@ -3226,7 +3226,8 @@ typedef enum : NSUInteger {
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__); // DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__);
DDLogInfo(@"%@ uiDatabaseDidUpdateExternally: %zd", self.logTag, self.viewItems.count);
if (self.shouldObserveDBModifications) { if (self.shouldObserveDBModifications) {
// External database modifications can't be converted into incremental updates, // External database modifications can't be converted into incremental updates,
@ -3241,6 +3242,8 @@ typedef enum : NSUInteger {
- (void)uiDatabaseWillUpdate:(NSNotification *)notification - (void)uiDatabaseWillUpdate:(NSNotification *)notification
{ {
DDLogInfo(@"%@ uiDatabaseWillUpdate: %zd", self.logTag, self.viewItems.count);
// HACK to work around radar #28167779 // HACK to work around radar #28167779
// "UICollectionView performBatchUpdates can trigger a crash if the collection view is flagged for layout" // "UICollectionView performBatchUpdates can trigger a crash if the collection view is flagged for layout"
// more: https://github.com/PSPDFKit-labs/radar.apple.com/tree/master/28167779%20-%20CollectionViewBatchingIssue // more: https://github.com/PSPDFKit-labs/radar.apple.com/tree/master/28167779%20-%20CollectionViewBatchingIssue
@ -3258,10 +3261,13 @@ typedef enum : NSUInteger {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
if (!self.shouldObserveDBModifications) { if (!self.shouldObserveDBModifications) {
DDLogInfo(@"%@ uiDatabaseDidUpdate (ignoring): %zd", self.logTag, self.viewItems.count);
return; return;
} }
DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__); DDLogInfo(@"%@ uiDatabaseDidUpdate (ignoring): %zd", self.logTag, self.viewItems.count);
// DDLogVerbose(@"%@ %s", self.logTag, __PRETTY_FUNCTION__);
NSArray *notifications = notification.userInfo[OWSUIDatabaseConnectionNotificationsKey]; NSArray *notifications = notification.userInfo[OWSUIDatabaseConnectionNotificationsKey];
OWSAssert([notifications isKindOfClass:[NSArray class]]); OWSAssert([notifications isKindOfClass:[NSArray class]]);
@ -3394,7 +3400,8 @@ typedef enum : NSUInteger {
for (YapDatabaseViewRowChange *rowChange in rowChanges) { for (YapDatabaseViewRowChange *rowChange in rowChanges) {
switch (rowChange.type) { switch (rowChange.type) {
case YapDatabaseViewChangeDelete: { case YapDatabaseViewChangeDelete: {
DDLogVerbose(@"YapDatabaseViewChangeDelete collectionKey: %@, indexPath: %@, finalIndex: %lu", DDLogInfo(@"%@ YapDatabaseViewChangeDelete collectionKey: %@, indexPath: %@, finalIndex: %lu",
self.logTag,
rowChange.collectionKey, rowChange.collectionKey,
rowChange.indexPath, rowChange.indexPath,
(unsigned long)rowChange.finalIndex); (unsigned long)rowChange.finalIndex);
@ -3404,7 +3411,8 @@ typedef enum : NSUInteger {
break; break;
} }
case YapDatabaseViewChangeInsert: { case YapDatabaseViewChangeInsert: {
DDLogVerbose(@"YapDatabaseViewChangeInsert collectionKey: %@, newIndexPath: %@, finalIndex: %lu", DDLogInfo(@"%@ YapDatabaseViewChangeInsert collectionKey: %@, newIndexPath: %@, finalIndex: %lu",
self.logTag,
rowChange.collectionKey, rowChange.collectionKey,
rowChange.newIndexPath, rowChange.newIndexPath,
(unsigned long)rowChange.finalIndex); (unsigned long)rowChange.finalIndex);
@ -3421,8 +3429,9 @@ typedef enum : NSUInteger {
break; break;
} }
case YapDatabaseViewChangeMove: { case YapDatabaseViewChangeMove: {
DDLogVerbose(@"YapDatabaseViewChangeMove collectionKey: %@, indexPath: %@, newIndexPath: %@, " DDLogInfo(@"%@ YapDatabaseViewChangeMove collectionKey: %@, indexPath: %@, newIndexPath: %@, "
@"finalIndex: %lu", @"finalIndex: %lu",
self.logTag,
rowChange.collectionKey, rowChange.collectionKey,
rowChange.indexPath, rowChange.indexPath,
rowChange.newIndexPath, rowChange.newIndexPath,
@ -3431,7 +3440,8 @@ typedef enum : NSUInteger {
break; break;
} }
case YapDatabaseViewChangeUpdate: { case YapDatabaseViewChangeUpdate: {
DDLogVerbose(@"YapDatabaseViewChangeUpdate collectionKey: %@, indexPath: %@, finalIndex: %lu", DDLogInfo(@"%@ YapDatabaseViewChangeUpdate collectionKey: %@, indexPath: %@, finalIndex: %lu",
self.logTag,
rowChange.collectionKey, rowChange.collectionKey,
rowChange.indexPath, rowChange.indexPath,
(unsigned long)rowChange.finalIndex); (unsigned long)rowChange.finalIndex);
@ -3442,7 +3452,7 @@ typedef enum : NSUInteger {
} }
}; };
DDLogVerbose(@"self.viewItems.count: %zd -> %zd", oldViewItemCount, self.viewItems.count); DDLogInfo(@"%@ self.viewItems.count: %zd -> %zd", self.logTag, oldViewItemCount, self.viewItems.count);
BOOL shouldAnimateUpdates = [self shouldAnimateRowUpdates:rowChanges oldViewItemCount:oldViewItemCount]; BOOL shouldAnimateUpdates = [self shouldAnimateRowUpdates:rowChanges oldViewItemCount:oldViewItemCount];
void (^batchUpdatesCompletion)(BOOL) = ^(BOOL finished) { void (^batchUpdatesCompletion)(BOOL) = ^(BOOL finished) {
@ -5192,6 +5202,8 @@ typedef enum : NSUInteger {
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{ {
DDLogInfo(@"%@ collectionView:numberOfItemsInSection: %zd", self.logTag, self.viewItems.count);
return (NSInteger)self.viewItems.count; return (NSInteger)self.viewItems.count;
} }

Loading…
Cancel
Save