From 7843e725956b4110708b31049df831e8351c1e61 Mon Sep 17 00:00:00 2001 From: Yavor Georgiev Date: Thu, 2 Feb 2017 15:41:52 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20capture=20the=20current=20JS=20?= =?UTF-8?q?context=20in=20the=20session=20bind=20callback=20(#839)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js_sync.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js_sync.hpp b/src/js_sync.hpp index 21fe26a4..35d1de1d 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -366,7 +366,7 @@ void SyncClass::populate_sync_config(ContextType ctx, ObjectType realm_constr Protected protected_sync(ctx, sync_constructor); Protected protected_ctx(Context::get_global_context(ctx)); - EventLoopDispatcher bind([=](const std::string& path, const realm::SyncConfig& config, std::shared_ptr) { + EventLoopDispatcher bind([protected_ctx, protected_sync](const std::string& path, const realm::SyncConfig& config, std::shared_ptr) { HANDLESCOPE if (config.user->is_admin()) { // FIXME: This log-in callback is called while the object store still holds some sync-related locks. @@ -379,11 +379,11 @@ void SyncClass::populate_sync_config(ContextType ctx, ObjectType realm_constr thread.detach(); } else { - ObjectType user_constructor = Object::validated_get_object(ctx, protected_sync, std::string("User")); - FunctionType authenticate = Object::validated_get_function(ctx, user_constructor, std::string("_authenticateRealm")); + ObjectType user_constructor = Object::validated_get_object(protected_ctx, protected_sync, std::string("User")); + FunctionType authenticate = Object::validated_get_function(protected_ctx, user_constructor, std::string("_authenticateRealm")); ValueType arguments[3]; - arguments[0] = create_object>(ctx, new SharedUser(config.user)); + arguments[0] = create_object>(protected_ctx, new SharedUser(config.user)); arguments[1] = Value::from_string(protected_ctx, path.c_str()); arguments[2] = Value::from_string(protected_ctx, config.realm_url.c_str()); Function::call(protected_ctx, authenticate, 3, arguments);