Skip to content

Commit

Permalink
Avoid copying args (#4629)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Jun 8, 2022
1 parent 50ce909 commit 82e7ef2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ realm.write(() => {
```

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None.
* Fixed build error (call to implicitly-deleted copy constructor of 'realm::js::RealmClass<realm::js::realmjsi::Types>::Arguments') (follow up to [#4568](https://github.com/realm/realm-js/pull/4568))

### Compatibility
* Atlas App Services.
Expand Down
8 changes: 4 additions & 4 deletions src/js_realm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1165,10 +1165,10 @@ void RealmClass<T>::async_open_realm(ContextType ctx, ObjectType this_object, Ar
Function<T>::callback(protected_ctx, protected_callback, protected_this, 1, callback_arguments);
}

std::shared_ptr<AsyncOpenTask> task;
task = Realm::get_synchronized_realm(config);
std::shared_ptr<AsyncOpenTask> task = Realm::get_synchronized_realm(config);

realm::util::EventLoopDispatcher<RealmCallbackHandler> callback_handler([=, defaults = std::move(defaults),
realm::util::EventLoopDispatcher<RealmCallbackHandler> callback_handler([=, args_count = args.count,
defaults = std::move(defaults),
constructors = std::move(constructors)](
ThreadSafeReference&& realm_ref,
std::exception_ptr error) {
Expand Down Expand Up @@ -1200,7 +1200,7 @@ void RealmClass<T>::async_open_realm(ContextType ctx, ObjectType this_object, Ar

try {
ValueType unprotected_args = protected_args;
handle_initial_subscriptions(protected_ctx, args.count - 1, &unprotected_args, realm, realm_exists);
handle_initial_subscriptions(protected_ctx, args_count - 1, &unprotected_args, realm, realm_exists);
}
catch (TypeErrorException e) {
auto error = make_js_error<T>(ctx, e.what());
Expand Down

0 comments on commit 82e7ef2

Please sign in to comment.