Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RealmSet contains fails with unmanaged object #1612

Closed
clementetb opened this issue Dec 21, 2023 · 2 comments
Closed

RealmSet contains fails with unmanaged object #1612

clementetb opened this issue Dec 21, 2023 · 2 comments

Comments

@clementetb
Copy link
Contributor

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)
    }
@rorbech
Copy link
Contributor

rorbech commented Dec 21, 2023

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.

@rorbech
Copy link
Contributor

rorbech commented Apr 4, 2024

Fixed by #1716

@rorbech rorbech closed this as completed Apr 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants