From d487eede9e56c76de5cbcb41ada7b24a4803dd4f Mon Sep 17 00:00:00 2001 From: Iason Paraskevopoulos Date: Wed, 21 Aug 2024 17:07:50 +0100 Subject: [PATCH] Destroy attached objects before destroying the queue Reorganizes the wayland::surface's member variables in a way that the objects attached to the queue are destroyed before the queue. Signed-off-by: Iason Paraskevopoulos Change-Id: Ifbc3f285005ae01b0cc75d2827e424db58c392e1 --- wsi/wayland/surface.cpp | 2 +- wsi/wayland/surface.hpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wsi/wayland/surface.cpp b/wsi/wayland/surface.cpp index 923b67e..07ef607 100644 --- a/wsi/wayland/surface.cpp +++ b/wsi/wayland/surface.cpp @@ -128,10 +128,10 @@ struct surface::init_parameters surface::surface(const init_parameters ¶ms) : wsi::surface() , wayland_display(params.display) + , surface_queue(nullptr) , wayland_surface(params.surf) , supported_formats(params.allocator) , properties(this, params.allocator) - , surface_queue(nullptr) , last_frame_callback(nullptr) , present_pending(false) { diff --git a/wsi/wayland/surface.hpp b/wsi/wayland/surface.hpp index b20c20b..fd005d4 100644 --- a/wsi/wayland/surface.hpp +++ b/wsi/wayland/surface.hpp @@ -148,6 +148,14 @@ private: /** The native Wayland display */ wl_display *wayland_display; + + /** + * Container for a private queue for surface events generated by the layer. + * The queue is also used for dispatching frame callback events. + * It should be destroyed after the objects that attached to it. + */ + wayland_owner surface_queue; + /** The native Wayland surface */ wl_surface *wayland_surface; /** A list of DRM formats supported by the Wayland compositor on this surface */ @@ -163,12 +171,6 @@ private: /** Container for the surface specific zwp_linux_surface_synchronization_v1 interface. */ wayland_owner surface_sync_interface; - /** - * Container for a private queue for surface events generated by the layer. - * The queue is also used for dispatching frame callback events. - */ - wayland_owner surface_queue; - /** * Container for a callback object for the latest frame done event. *