wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.69k stars 1.12k forks source link

ReaderPostServiceRemote fetchPostsFromEndpoint called after logout #1776

Closed astralbodies closed 10 years ago

astralbodies commented 10 years ago

After logging out of WP.com (no self hosted) a call is being made to backfill Reader posts but the endpoint URL on the topics is nil. This is causing the app to crash. May be related to #1772

astralbodies commented 10 years ago

Logging back in after the crash results in:

 2014-05-28 12:11:28.962 WordPress[10512:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no object at index 1 in section at index 0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010507e495 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000104c2799e objc_exception_throw + 43
    2   CoreData                            0x000000010484dc08 -[NSFetchedResultsController objectAtIndexPath:] + 408
    3   WordPress                           0x00000001001f8ad9 -[ReaderPostsViewController tableView:heightForRowAtIndexPath:] + 137
    4   UIKit                               0x0000000102efda30 -[UISectionRowData heightForRow:inSection:canGuess:] + 234
    5   UIKit                               0x0000000102f04334 -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:] + 582
    6   UIKit                               0x0000000102f04432 -[UITableViewRowData rectForGlobalRow:heightCanBeGuessed:] + 150
    7   UIKit                               0x0000000102f04dd5 -[UITableViewRowData globalRowsInRect:canGuess:] + 359
    8   UIKit                               0x0000000102da6531 -[UITableView _visibleGlobalRowsInRect:] + 210
    9   UIKit                               0x0000000102da57ab -[UITableView _updateVisibleCellsNow:] + 881
    10  UIKit                               0x0000000102db7721 -[UITableView layoutSubviews] + 207
    11  UIKit                               0x0000000102d4b993 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 354
    12  QuartzCore                          0x0000000102a54802 -[CALayer layoutSublayers] + 151
    13  QuartzCore                          0x0000000102a49369 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363
    14  QuartzCore                          0x0000000102a491ea _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    15  QuartzCore                          0x00000001029bcfb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252
    16  QuartzCore                          0x00000001029be030 _ZN2CA11Transaction6commitEv + 394
    17  QuartzCore                          0x00000001029be69d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
    18  CoreFoundation                      0x0000000105049dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    19  CoreFoundation                      0x0000000105049d37 __CFRunLoopDoObservers + 391
    20  CoreFoundation                      0x0000000105029522 __CFRunLoopRun + 946
    21  CoreFoundation                      0x0000000105028d83 CFRunLoopRunSpecific + 467
    22  GraphicsServices                    0x00000001065aaf04 GSEventRunModal + 161
    23  UIKit                               0x0000000102cebe33 UIApplicationMain + 1010
    24  WordPress                           0x00000001000057f4 main + 68
    25  libdyld.dylib                       0x000000010563b5fd start + 1
    26  ???                                 0x0000000000000001 0x0 + 1
)
aerych commented 10 years ago

A sync is kicked off anytime an account changes. I think this might be a holdover from the old panels layout when the reader could still be visible and need to refresh its content. I'm thinking we probably don't need it at this point and it can be removed.

aerych commented 10 years ago

Dug into this a bit more. The sync is still proper as we want data ready and waiting when the user changes tabs, so disregard what I said earlier. The nil topic was difficult to reproduce on demand, but was potentially happening due to NSUserDefaults storing the URI representation of a temporary NSManagedObjectID for a reader topic. In any even, I can't reproduce this at all after the changes in PR #1803. Once its merge up, lets test a bit more and if we're still unable to reproduce the crash we'll call it closed.

aerych commented 10 years ago

Calling this one closed.