-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Deleting a bunch of objects at once may cause a crash in migration #5546
Comments
Can you please share some code that reproduces the issue so we'll be able to verify that whatever fix we make addresses the problem you're encountering? |
This was simple to reproduce. First create some data (doesn't matter what the data is):
Then increment version number and implement the following migration block:
|
Thank you! |
@anlaital did you find any workaround for this? :) |
Maintaining the enumeration order when deleting the objects doesn't crash. |
@anlaital 👍🏻👍🏻 Thank you, will try :) |
any updates of this issue? |
Goals
Delete objects in a migration.
Expected Results
Objects get deleted.
Actual Results
Realm crashes with the following stack trace:
This crash is caused by the following method (array index out-of-bounds):
Here's a very simple fixed version that sorts the indices before looping (this fixes the crash, haven't verified that it works semantically correctly):
Version of Realm and Tooling
Realm framework version: 3.0.2
The text was updated successfully, but these errors were encountered: