Commit d73291f1 authored by Dominik Charousset's avatar Dominik Charousset

Fix possible invalid write in intrusive_ptr

parent 483a06aa
......@@ -87,10 +87,11 @@ class intrusive_ptr : detail::comparable<intrusive_ptr<T>>,
}
void reset(pointer new_value = nullptr, bool add_ref = true) {
if (m_ptr) {
m_ptr->deref();
}
auto old = m_ptr;
set_ptr(new_value, add_ref);
if (old) {
old->deref();
}
}
template <class... Ts>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment