fix leaking realm

This commit is contained in:
Ari Lazier 2016-05-05 17:10:56 -07:00
parent 3b24a4270e
commit 7b3fa3bc42
2 changed files with 2 additions and 1 deletions

View File

@ -34,7 +34,7 @@ WeakRealmNotifier::WeakRealmNotifier(const std::shared_ptr<Realm>& realm, bool c
}; };
CFRunLoopSourceContext ctx{}; CFRunLoopSourceContext ctx{};
ctx.info = new RefCountedWeakPointer{realm, {1}}; ctx.info = new RefCountedWeakPointer{realm, {0}};
ctx.perform = [](void* info) { ctx.perform = [](void* info) {
if (auto realm = static_cast<RefCountedWeakPointer*>(info)->realm.lock()) { if (auto realm = static_cast<RefCountedWeakPointer*>(info)->realm.lock()) {
realm->notify(); realm->notify();

View File

@ -247,6 +247,7 @@ void Realm::update_schema(std::unique_ptr<Schema> schema, uint64_t version)
if (m_config.migration_function) { if (m_config.migration_function) {
m_config.migration_function(old_realm, shared_from_this()); m_config.migration_function(old_realm, shared_from_this());
} }
m_config.migration_function = nullptr;
}; };
try { try {