Used std::exchange for a thing

Note we don't really need to set the other object's renderer ptr to null since
the canvas dtor doesn't destroy it anymore, but still. Good to do.
This commit is contained in:
Charles Dang 2018-03-19 10:36:20 +11:00
parent 1167e3e78b
commit 68f4bd14d6

View file

@ -1375,15 +1375,13 @@ canvas::canvas(canvas&& c)
, w_(c.w_)
, h_(c.h_)
, texture_(std::move(c.texture_))
, renderer_(c.renderer_)
, renderer_(std::exchange(c.renderer_, nullptr))
, variables_(c.variables_)
, functions_(c.functions_)
, is_dirty_(c.is_dirty_)
, size_changed_(c.size_changed_)
, cache_invalidated_(c.cache_invalidated_)
{
// Needed to ensure the other object doesn't destroy our software renderer prematurely.
c.renderer_ = nullptr;
}
canvas::~canvas()