From 015d001d5c008ddb045cc6490cc77867e99bbad5 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Fri, 17 Aug 2018 11:24:08 +0200 Subject: [PATCH] Using a GC'ed context will cause a crash (#1969) * Using a GC'ed context will cause a crash --- CHANGELOG.md | 1 + src/js_sync.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae43901b..70a58f83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### Bug fixes * React Native for Android now supports the Android Gradle Plugin 3.0 (#1742). +* [Sync] Fixed a crash in subscription listeners (#1926). * [Sync] Classes used by the Object-level permission system are now automatically part of the schema for Query-based Realms (#1966). * [Sync] Fixed distinct queries with query-based sync (broken since v2.11.0). * Support parallel run of muliple iOS builds with React Native on the same CI machine. diff --git a/src/js_sync.hpp b/src/js_sync.hpp index b15fedcf..495ed511 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -763,7 +763,7 @@ void SubscriptionClass::add_listener(ContextType ctx, ObjectType this_object, ValueType arguments[2]; arguments[0] = static_cast(protected_this), - arguments[1] = Value::from_number(ctx, static_cast(subscription->state())); + arguments[1] = Value::from_number(protected_ctx, static_cast(subscription->state())); Function::callback(protected_ctx, protected_callback, protected_this, 2, arguments); });