From 068e367bf175995cee4da178e4b3a6dd4f4f677c Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Fri, 9 Jul 2021 18:55:06 -0400 Subject: [PATCH] Add missing move constructor for DrawState The use of vector::emplace_back can cause the file descriptors in the acquire fence list to be closed due to the behavior of the default copy constructor for DrawState. When this occurs, a list of dangling file descriptors is held, causing a crash. --- common/compositor/renderstate.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/compositor/renderstate.h b/common/compositor/renderstate.h index 34651371a..c613ca63a 100644 --- a/common/compositor/renderstate.h +++ b/common/compositor/renderstate.h @@ -74,6 +74,18 @@ struct DrawState { } } + DrawState() = default; + + DrawState(DrawState &&other) { + surface_ = other.surface_; + destroy_surface_ = other.destroy_surface_; + retire_fence_ = other.retire_fence_; + + states_.swap(other.states_); + acquire_fences_.swap(other.acquire_fences_); + media_state_ = std::move(other.media_state_); + } + std::vector states_; MediaState media_state_; NativeSurface *surface_;