-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
2 - S (<= 1 week)
-
5958
-
Not Needed
Describe your problem or use case
There are still different ways to unregister various callback mechanism throughout the C-API.
Previously realm_add_realm_changed_callback and realm_add_schema_changed_callback have been updated in https://github.com/realm/realm-core/issues/5217 to follow the C-API managed approach of returning a token object that could be released through realm_release to unregister the callbacks.
There are still numerous use cases where the C-API has both a x_register and a x_unregister method, which is annoying as we cannot just manage all C-API allocated resources in a common way.
Identified APIs:
https://github.com/realm/realm-core/blob/master/src/realm.h#L3853
https://github.com/realm/realm-core/blob/master/src/realm.h#L3938
https://github.com/realm/realm-core/blob/master/src/realm.h#L3961
Describe the solution you'd like
Would be nice if all callback registrations could just follow the same pattern of releasing resources by calling realm_release with a token object issued when registrating the callback. Since all these callbacks are usually not on the hot path, I don't see an issue in the additional allocation.
- is depended on by
-
RKOTLIN-299 SyncSession - ProgressListeners
- Closed