RealmSet contains fails with unmanaged object
clementetb opened this issue · comments
clementetb commented
Invoking RealmSet<RealmObject>.contains
on a managed set passing an unmanaged Realm value would result in the following exception:
IllegalStateException: Cannot modify managed objects outside of a write transaction
The exception is a bit odd, how come we modify objects during the contains?
@Test
fun containsFailWith() {
val unmanaged = RealmSetContainer()
val managed = realm.writeBlocking {
copyToRealm(
RealmSetContainer().apply {
objectSetField.add(RealmSetContainer())
}
)
}
managed.objectSetField.contains(unmanaged)
}
Claus Rørbech commented
This is fixed in https://github.com/realm/realm-kotlin/tree/next-major as part of the Collections in mixed
-implmentation. Previous issue was #1488. It required quite some changes throughout the operator-infrastructure so don't think it is worth fixing in isolation.
Claus Rørbech commented
Fixed by #1716