mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 14:54:33 +00:00
Fix another crash involving protected values
This commit is contained in:
parent
275334fa7e
commit
8e5afeccc9
@ -63,7 +63,10 @@ class RealmDelegate : public BindingContext {
|
|||||||
RealmDelegate(std::weak_ptr<Realm> realm, GlobalContextType ctx) : m_context(ctx), m_realm(realm) {}
|
RealmDelegate(std::weak_ptr<Realm> realm, GlobalContextType ctx) : m_context(ctx), m_realm(realm) {}
|
||||||
|
|
||||||
~RealmDelegate() {
|
~RealmDelegate() {
|
||||||
remove_all_notifications();
|
// All protected values need to be unprotected while the context is retained.
|
||||||
|
m_defaults.clear();
|
||||||
|
m_constructors.clear();
|
||||||
|
m_notifications.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_notification(FunctionType notification) {
|
void add_notification(FunctionType notification) {
|
||||||
|
@ -32,7 +32,7 @@ class Protected<JSGlobalContextRef> {
|
|||||||
Protected(Protected<JSGlobalContextRef> &&other) : m_context(other.m_context) {
|
Protected(Protected<JSGlobalContextRef> &&other) : m_context(other.m_context) {
|
||||||
other.m_context = nullptr;
|
other.m_context = nullptr;
|
||||||
}
|
}
|
||||||
Protected(JSGlobalContextRef ctx) : m_context(ctx) {
|
explicit Protected(JSGlobalContextRef ctx) : m_context(ctx) {
|
||||||
JSGlobalContextRetain(m_context);
|
JSGlobalContextRetain(m_context);
|
||||||
}
|
}
|
||||||
~Protected() {
|
~Protected() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user