-
Notifications
You must be signed in to change notification settings - Fork 52
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
Crash in copyToRealm. #1409
Comments
Hi @darkan23 This happens when you try to
Is it something like this you are doing? |
Yes, before I save the phone, I'm looking for a client.
|
Yes, that pattern is a problem. The reason it is a problem is that Realm Objects are versioned and thus might change once you enter a write transaction. I.e. in your logic, you might read Client at version 1 and store it in your object, then, just before doing the write, another thread deletes that Client object. Then when you enter the write, it is unclear what the correct behavior would be. In cases like this, you basically have two options:
I would strongly recommend option 2. |
Thanks for the help! |
Hi! Is this a good example of using:
Thank you! |
You don't need the last
|
@cmelchior Thank you! does it actually mean, this is another option to resolve the issue described by @darkan23 ? any of these options is preferable from performance or any other point of view? |
Using |
Thank you @cmelchior ! |
How frequently does the bug occur?
Sometimes
Description
I've got a weird crash when copyToRealm.
I am trying to save the given object in Realm:
In this case, if you call findLatest before saving, as the error says, then after the error it will say that the object has not yet been created, use copyToRealm
What am I doing wrong??
Stacktrace & log output
Can you reproduce the bug?
Reproduction Steps
No response
Version
1.8.0
What Atlas App Services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
Android, v. 10
Build environment
Android Studio version: ...
Android Build Tools version: ...
Gradle version: ...
The text was updated successfully, but these errors were encountered: