realm-java: native crash in RealmResults#deleteAllFromRealm()
Goal
allow to call RealmResults.deleteAllFromRealm()
against the RealmResults
object which contains deleted object in it.
Expected Results
no native crash and all existing objects are deleted.
Actual Results
native crash
Steps & Code to Reproduce
executing following sample code
Code Sample
realm.beginTransaction();
realm.createObject(Dog.class);
realm.createObject(Dog.class);
realm.commitTransaction();
RealmResults<Dog> results = realm.where(Dog.class).findAll();
realm.beginTransaction();
Dog dog = results.get(0);
dog.deleteFromRealm();
results.deleteAllFromRealm();
realm.commitTransaction();
Version of Realm and tooling
Realm version(s): current master
Android Studio version: 2.1
Which Android version and device: 4.1.1 on genymotion
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (17 by maintainers)
Commits related to this issue
- Simple test to reproduce crash as reported by issue #2759 — committed to realm/realm-java by deleted user 8 years ago
I don’t think we should call
sync_if_needed
since it may cause unintentional deletes of objects that are not included in the results on current version, but included in the results on latest version.We have uncovered a bug in the underlying database and are working on a fix: https://github.com/realm/realm-core/issues/827