fix for handle scope warning

This commit is contained in:
Ari Lazier 2016-11-11 11:41:27 -08:00
parent 7683d1185a
commit b2077910a4
6 changed files with 8 additions and 6 deletions

View File

@ -260,7 +260,7 @@ void ListClass<T>::add_listener(ContextType ctx, ObjectType this_object, size_t
Protected<typename T::GlobalContext> protected_ctx(Context<T>::get_global_context(ctx));
auto token = list->add_notification_callback([=](CollectionChangeSet change_set, std::exception_ptr exception) {
typename T::HandleScope scope;
HANDLESCOPE
ValueType arguments[2];
arguments[0] = static_cast<ObjectType>(protected_this);

View File

@ -108,7 +108,7 @@ class RealmDelegate : public BindingContext {
std::weak_ptr<realm::Realm> m_realm;
void notify(const char *notification_name) {
typename T::HandleScope scope;
HANDLESCOPE
SharedRealm realm = m_realm.lock();
if (!realm) {

View File

@ -244,7 +244,7 @@ void ResultsClass<T>::add_listener(ContextType ctx, ObjectType this_object, size
Protected<typename T::GlobalContext> protected_ctx(Context<T>::get_global_context(ctx));
auto token = results->add_notification_callback([=](CollectionChangeSet change_set, std::exception_ptr exception) {
typename T::HandleScope scope;
HANDLESCOPE
ValueType arguments[2];
arguments[0] = static_cast<ObjectType>(protected_this);

View File

@ -269,7 +269,7 @@ void SyncClass<T>::populate_sync_config(ContextType ctx, FunctionType realm_cons
Protected<typename T::GlobalContext> protected_ctx(Context<T>::get_global_context(ctx));
auto handler = [=](const std::string& path, const realm::SyncConfig& config, std::shared_ptr<SyncSession>) {
typename T::HandleScope handle_scope;
HANDLESCOPE
if (config.user->is_admin()) {
// FIXME: This log-in callback is called while the object store still holds some sync-related locks.
// Notify the object store of the access token asynchronously to avoid the deadlock that would result

View File

@ -24,6 +24,8 @@
#include "js_types.hpp"
#define HANDLESCOPE
namespace realm {
namespace jsc {
@ -34,7 +36,6 @@ struct Types {
using Object = JSObjectRef;
using String = JSStringRef;
using Function = JSObjectRef;
using HandleScope = void *;
using ConstructorCallback = JSObjectCallAsConstructorCallback;
using FunctionCallback = JSObjectCallAsFunctionCallback;

View File

@ -34,6 +34,8 @@
#define REALM_V8_ARRAY_BUFFER_API 1
#endif
#define HANDLESCOPE Nan::HandleScope handle_scope;
namespace realm {
namespace node {
@ -44,7 +46,6 @@ struct Types {
using Object = v8::Local<v8::Object>;
using String = v8::Local<v8::String>;
using Function = v8::Local<v8::Function>;
using HandleScope = Nan::HandleScope;
using ConstructorCallback = v8::FunctionCallback;
using FunctionCallback = v8::FunctionCallback;