From 7b3fa3bc426e52b65be45ab36940b779e241313a Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 5 May 2016 17:10:56 -0700 Subject: [PATCH] fix leaking realm --- src/impl/apple/weak_realm_notifier.cpp | 2 +- src/shared_realm.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/impl/apple/weak_realm_notifier.cpp b/src/impl/apple/weak_realm_notifier.cpp index da403ad7..0ce6300f 100644 --- a/src/impl/apple/weak_realm_notifier.cpp +++ b/src/impl/apple/weak_realm_notifier.cpp @@ -34,7 +34,7 @@ WeakRealmNotifier::WeakRealmNotifier(const std::shared_ptr& realm, bool c }; CFRunLoopSourceContext ctx{}; - ctx.info = new RefCountedWeakPointer{realm, {1}}; + ctx.info = new RefCountedWeakPointer{realm, {0}}; ctx.perform = [](void* info) { if (auto realm = static_cast(info)->realm.lock()) { realm->notify(); diff --git a/src/shared_realm.cpp b/src/shared_realm.cpp index 865cbe6b..bdc2b1fd 100644 --- a/src/shared_realm.cpp +++ b/src/shared_realm.cpp @@ -247,6 +247,7 @@ void Realm::update_schema(std::unique_ptr schema, uint64_t version) if (m_config.migration_function) { m_config.migration_function(old_realm, shared_from_this()); } + m_config.migration_function = nullptr; }; try {