mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 14:54:33 +00:00
Merge pull request #78 from realm/mar/weakrealmnotifier-leak
Fix a potential leak within WeakRealmNotifier
This commit is contained in:
commit
57ee591809
@ -69,6 +69,8 @@ WeakRealmNotifier::WeakRealmNotifier(WeakRealmNotifier&& rgt)
|
|||||||
WeakRealmNotifier& WeakRealmNotifier::operator=(WeakRealmNotifier&& rgt)
|
WeakRealmNotifier& WeakRealmNotifier::operator=(WeakRealmNotifier&& rgt)
|
||||||
{
|
{
|
||||||
WeakRealmNotifierBase::operator=(std::move(rgt));
|
WeakRealmNotifierBase::operator=(std::move(rgt));
|
||||||
|
|
||||||
|
invalidate();
|
||||||
m_runloop = rgt.m_runloop;
|
m_runloop = rgt.m_runloop;
|
||||||
m_signal = rgt.m_signal;
|
m_signal = rgt.m_signal;
|
||||||
rgt.m_runloop = nullptr;
|
rgt.m_runloop = nullptr;
|
||||||
@ -78,6 +80,11 @@ WeakRealmNotifier& WeakRealmNotifier::operator=(WeakRealmNotifier&& rgt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WeakRealmNotifier::~WeakRealmNotifier()
|
WeakRealmNotifier::~WeakRealmNotifier()
|
||||||
|
{
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeakRealmNotifier::invalidate()
|
||||||
{
|
{
|
||||||
if (m_signal) {
|
if (m_signal) {
|
||||||
CFRunLoopSourceInvalidate(m_signal);
|
CFRunLoopSourceInvalidate(m_signal);
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
void notify();
|
void notify();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void invalidate();
|
||||||
|
|
||||||
CFRunLoopRef m_runloop;
|
CFRunLoopRef m_runloop;
|
||||||
CFRunLoopSourceRef m_signal;
|
CFRunLoopSourceRef m_signal;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user