Skip to content

Commit a3044fe

Browse files
committed
Fix ScopedObserver move assignment
1 parent f4b0a12 commit a3044fe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

include/react/Observer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class ScopedObserver
130130
ScopedObserver& operator=(ScopedObserver&& other)
131131
{
132132
obs_ = std::move(other.obs_);
133+
return *this;
133134
}
134135

135136
// Deleted default ctor, copy ctor and assignment
@@ -139,7 +140,8 @@ class ScopedObserver
139140

140141
~ScopedObserver()
141142
{
142-
obs_.Detach();
143+
if (obs_.IsValid())
144+
obs_.Detach();
143145
}
144146

145147
bool IsValid() const

0 commit comments

Comments
 (0)