1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a bug in the ValueTree move constructor that could leave listeners pointing to a moved-from object

This commit is contained in:
jules 2018-02-14 12:17:58 +00:00
parent d17595518f
commit b86b95b980

View file

@ -639,11 +639,13 @@ ValueTree& ValueTree::operator= (const ValueTree& other)
ValueTree::ValueTree (ValueTree&& other) noexcept
: object (static_cast<SharedObject::Ptr&&> (other.object))
{
if (object != nullptr)
object->valueTreesWithListeners.removeValue (&other);
}
ValueTree::~ValueTree()
{
if (listeners.size() > 0 && object != nullptr)
if (! listeners.isEmpty() && object != nullptr)
object->valueTreesWithListeners.removeValue (this);
}