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

Expose Obj::get_parent_object in the C API #5851

Merged
merged 6 commits into from
Sep 14, 2022

Conversation

nicola-cab
Copy link
Member

What, How & Why?

Fixes: #5837

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed.

src/realm.h Outdated Show resolved Hide resolved
Comment on lines +34 to +35
if (parent)
*parent = realm_object_t{realm::Object{object->get_realm(), object->obj().get_parent_object()}};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen the C API littered with these types of checks and I'm no sure I understand their purpose. Not supplying a pointer to store the parent in sounds like a fundamental error in using the API. I'd rather have this be an assert than the method silently not doing anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but it is important we keep the same pattern, I can clean all this up in a separate PR.

Co-authored-by: Yavor Georgiev <[email protected]>
@@ -244,11 +244,15 @@ RLM_API realm_query_t* realm_query_parse_for_list(const realm_list_t* list, cons
const realm_query_arg_t* args)
{
return wrap_err([&]() {
auto existing_query = list->get_query();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is part of another PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes sorry, I have multiple small PRs open... my bad. let me revert this..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code has been reverted

@nicola-cab nicola-cab requested a review from jedelbo September 14, 2022 10:12
@nicola-cab nicola-cab merged commit 78bd122 into master Sep 14, 2022
@nicola-cab nicola-cab deleted the nc/expose_object_parent_c_api branch September 14, 2022 13:56
tgoyne added a commit that referenced this pull request Sep 16, 2022
…nification

* origin/master:
  Stop forcing enums to be 64 bits unnecessarily
  clean up documentation of internal fields in config structs
  SyncConfig should be default constructible
  Traversal functions use IteratorControl values rather than true/false which is more expressive (#5857)
  Fix handling of 4-byte UTF8 values on Windows (#5803)
  Encode links in a way the server can understand (#5835)
  expose `Group::remove_table` in the C API (#5860)
  Disable auto refresh for old realm during migration (#5856)
  Expose `list_find` in the c api (#5848)
  Do not allow asymmetric tables in pbs (#5853)
  Refactor link tracing code (#5796)
  Expose `Obj::get_parent_object` in the C API (#5851)
  Update app.hpp (#5854)
  Fix appending to list ignores existing query (#5850)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[C-API] Expose realm_object_get_parent
4 participants