-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fix SyncSession crashing when accessed after receiving remote changes #1071
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just one comment about the newly added test.
@@ -768,6 +836,7 @@ class SyncedRealmTests { | |||
localRealm.writeCopyTo(flexSyncConfig) | |||
} | |||
} | |||
flexApp.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// 4. With the original native dbPointer now being closed, accessing the syncSession for | ||
// the first time should still work. | ||
try { | ||
realm1.syncSession.pause() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an error happens here it will get swallowed by the finally
and we won't know whether the session is still accessible. I would check the session state has actually been updated after calling pause
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, finally
doesn't swallow the exception, it should still propagate and fail the test, but you are right. Checking the state would improve the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I didn't mean an exception gets swallowed but rather that the state itself doesn't get updated for some reason. Poor wording 🙊
Closes #1068
Note, when creating this patch I discovered another bug: #1070.
A test has been written that catch this but it is marked as
@Ignore
for now.