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() {
|
||||
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) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class Protected<JSGlobalContextRef> {
|
|||
Protected(Protected<JSGlobalContextRef> &&other) : m_context(other.m_context) {
|
||||
other.m_context = nullptr;
|
||||
}
|
||||
Protected(JSGlobalContextRef ctx) : m_context(ctx) {
|
||||
explicit Protected(JSGlobalContextRef ctx) : m_context(ctx) {
|
||||
JSGlobalContextRetain(m_context);
|
||||
}
|
||||
~Protected() {
|
||||
|
|
Loading…
Reference in New Issue