From 273db056053b6f5a8227c722ce7f1c0dde6a7753 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 20 Apr 2016 15:38:49 -0700 Subject: [PATCH] Fix the initial ref count for WeakRealmNotifier Adding the run loop source to the run loop retains it, so the initial refcount should be 0, not 1. --- src/impl/apple/weak_realm_notifier.cpp | 2 +- 1 file changed, 1 insertion(+), 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();