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.
This commit is contained in:
Thomas Goyne 2016-04-20 15:38:49 -07:00
parent d0763d541e
commit 273db05605

View File

@ -34,7 +34,7 @@ WeakRealmNotifier::WeakRealmNotifier(const std::shared_ptr<Realm>& 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<RefCountedWeakPointer*>(info)->realm.lock()) {
realm->notify();