You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my application when a controller is pushed on a controller listening for changes I stop the listener. When the controller is popped, I re-query add a new listener and reload my table. If this happens while there are outstanding notifications, the count returned from the Realm query can reflect an updated state that is inconsistent with future notifications.
Expected Results
Stopping and "restarting" change listeners works without crashing.
Actual Results
Crash.
Thread 1Queue : com.apple.main-thread (serial)
#0 0x0000000189c24524 in objc_exception_throw ()
#1 0x000000018b1ea094 in +[NSException raise:format:arguments:] ()
#2 0x000000018bc7779c in -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] ()
#3 0x000000019122801c in -[UITableView _endCellAnimationsWithContext:] ()
#4 0x0000000100074d10 in ViewController.(handleRealmNotificationChanges in _7B856E3E683BE694D89D995864B2D80B)(RealmCollectionChange<Results<ThreadListModel>>) -> () at /Users/emuye/Code/RealmCrash/RealmCrash/ViewController.swift:59
#5 0x00000001000740cc in ViewController.(getData() -> ()).(closure #1) at /Users/emuye/Code/RealmCrash/RealmCrash/ViewController.swift:42
#6 0x0000000100b57fe0 in Results.(addNotificationBlock((RealmCollectionChange<Results<A>>) -> ()) -> RLMNotificationToken).(closure #1) at /Users/emuye/Code/RealmCrash/Pods/RealmSwift/RealmSwift/Results.swift:787
#7 0x0000000100b31b94 in thunk ()
#8 0x000000010039ce54 in RLMNotificationToken* RLMAddNotificationBlock<realm::Results>(objc_object*, realm::Results&, void (objc_object*, RLMCollectionChange*, NSError*) block_pointer, bool)::'lambda'(realm::CollectionChangeSet const&, std::exception_ptr)::operator()(realm::CollectionChangeSet const&, std::exception_ptr) const at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/RLMCollection.mm:345
#9 0x000000010039ca20 in realm::CollectionChangeCallback::Impl<RLMNotificationToken* RLMAddNotificationBlock<realm::Results>(objc_object*, realm::Results&, void (objc_object*, RLMCollectionChange*, NSError*) block_pointer, bool)::'lambda'(realm::CollectionChangeSet const&, std::exception_ptr)>::after(realm::CollectionChangeSet const&) at /Users/emuye/Code/RealmCrash/Pods/Realm/include/collection_notifications.hpp:154
#10 0x00000001002f3b40 in realm::CollectionChangeCallback::after(realm::CollectionChangeSet const&) at /Users/emuye/Code/RealmCrash/Pods/Realm/include/collection_notifications.hpp:119
#11 0x00000001002f3aa0 in auto realm::_impl::CollectionNotifier::after_advance()::$_9::operator()<std::__1::unique_lock<std::__1::mutex>, realm::_impl::CollectionNotifier::Callback>(std::__1::unique_lock<std::__1::mutex>&, realm::_impl::CollectionNotifier::Callback&) const at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp:320
#12 0x00000001002e5208 in void realm::_impl::CollectionNotifier::for_each_callback<realm::_impl::CollectionNotifier::after_advance()::$_9>(realm::_impl::CollectionNotifier::after_advance()::$_9&&) at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp:361
#13 0x00000001002e5110 in realm::_impl::CollectionNotifier::after_advance() at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp:309
#14 0x00000001002e74c4 in realm::_impl::NotifierPackage::after_advance() at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp:468
#15 0x0000000100526f84 in (anonymous namespace)::TransactLogObserver::TransactLogObserver<realm::_impl::transaction::advance(realm::SharedGroup&, realm::BindingContext*, realm::SchemaMode, realm::_impl::NotifierPackage&)::$_1>(realm::BindingContext*, realm::SharedGroup&, realm::_impl::transaction::advance(realm::SharedGroup&, realm::BindingContext*, realm::SchemaMode, realm::_impl::NotifierPackage&)::$_1&&, realm::util::Optional<realm::SchemaMode>, realm::_impl::NotifierPackage&) at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/transact_log_handler.cpp:283
#16 0x0000000100513ab8 in (anonymous namespace)::TransactLogObserver::TransactLogObserver<realm::_impl::transaction::advance(realm::SharedGroup&, realm::BindingContext*, realm::SchemaMode, realm::_impl::NotifierPackage&)::$_1>(realm::BindingContext*, realm::SharedGroup&, realm::_impl::transaction::advance(realm::SharedGroup&, realm::BindingContext*, realm::SchemaMode, realm::_impl::NotifierPackage&)::$_1&&, realm::util::Optional<realm::SchemaMode>, realm::_impl::NotifierPackage&) at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/transact_log_handler.cpp:262
#17 0x0000000100513a5c in realm::_impl::transaction::advance(realm::SharedGroup&, realm::BindingContext*, realm::SchemaMode, realm::_impl::NotifierPackage&) at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/transact_log_handler.cpp:829
#18 0x0000000100347198 in realm::_impl::RealmCoordinator::advance_to_ready(realm::Realm&) at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/realm_coordinator.cpp:669
#19 0x00000001004d03ac in realm::Realm::notify() at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp:572
#20 0x00000001005440f8 in realm::_impl::WeakRealmNotifier::Callback::operator()() at /Users/emuye/Code/RealmCrash/Pods/Realm/Realm/ObjectStore/src/impl/weak_realm_notifier.cpp:40
#21 0x0000000100544c4c in realm::util::EventLoopSignal<realm::_impl::WeakRealmNotifier::Callback>::EventLoopSignal(realm::_impl::WeakRealmNotifier::Callback&&)::'lambda'(void*)::operator()(void*) const at /Users/emuye/Code/RealmCrash/Pods/Realm/include/util/apple/event_loop_signal.hpp:37
#22 0x0000000100544c24 in realm::util::EventLoopSignal<realm::_impl::WeakRealmNotifier::Callback>::EventLoopSignal(realm::_impl::WeakRealmNotifier::Callback&&)::'lambda'(void*)::__invoke(void*) at /Users/emuye/Code/RealmCrash/Pods/Realm/include/util/apple/event_loop_signal.hpp:36
#23 0x000000018b198278 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#24 0x000000018b197bc0 in __CFRunLoopDoSources0 ()
#25 0x000000018b1957c0 in __CFRunLoopRun ()
#26 0x000000018b0c4048 in CFRunLoopRunSpecific ()
#27 0x000000018cb4a198 in GSEventRunModal ()
#28 0x00000001910b02fc in -[UIApplication _run] ()
#29 0x00000001910ab034 in UIApplicationMain ()
#30 0x00000001000b48a0 in main at /Users/emuye/Code/RealmCrash/RealmCrash/AppDelegate.swift:13
#31 0x000000018a0a85b8 in start ()
Code Sample
I've submitted a standalone app via email which reproduces the problem.
Version of Realm and Tooling
Realm version:
RealmSwift 2.1.1
Xcode version:
8.1
iOS/OSX version:
iOS 10.0
Dependency manager + version:
Cocoapods 1.1.1
The text was updated successfully, but these errors were encountered:
The issue here was the app we got via email wasn't handling the RealmCollectionChange.initial case, which meant that subsequent updates to the table view were applied while the tableview had inconsistent state.
I'm closing this since @jpsim's comment seems fine. I hope you consider this matter resolved. Feel free to reopen if you have any further questions or if you think we should do anything differently here.
In my application when a controller is pushed on a controller listening for changes I stop the listener. When the controller is popped, I re-query add a new listener and reload my table. If this happens while there are outstanding notifications, the count returned from the Realm query can reflect an updated state that is inconsistent with future notifications.
Expected Results
Stopping and "restarting" change listeners works without crashing.
Actual Results
Crash.
Code Sample
I've submitted a standalone app via email which reproduces the problem.
Version of Realm and Tooling
Realm version:
RealmSwift 2.1.1
Xcode version:
8.1
iOS/OSX version:
iOS 10.0
Dependency manager + version:
Cocoapods 1.1.1
The text was updated successfully, but these errors were encountered: