From b3c70d2b46a7bbc0162c26e290a87467397a8761 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Wed, 16 Sep 2020 14:19:21 -0700 Subject: [PATCH] gpu_display: Fix wayland destruction order The Wayland context was being destroyed before the surfaces were destroyed. This is because the drop order for fields inside a struct is the order in which they are declared [Rust RFC 1857]. BUG=b:168735942 TEST=boot Cuttlefish and then `adb reboot` Change-Id: I3581375a0694871ad50945f5c3ce432bb1f65653 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2415511 Reviewed-by: Gurchetan Singh Tested-by: kokoro Commit-Queue: Jason Macnak --- gpu_display/src/gpu_display_wl.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpu_display/src/gpu_display_wl.rs b/gpu_display/src/gpu_display_wl.rs index 3bd9d89f47..2eba9d6c2a 100644 --- a/gpu_display/src/gpu_display_wl.rs +++ b/gpu_display/src/gpu_display_wl.rs @@ -85,11 +85,11 @@ impl Surface { /// The user of `GpuDisplay` can use `AsRawFd` to poll on the compositor connection's file /// descriptor. When the connection is readable, `dispatch_events` can be called to process it. pub struct DisplayWl { - ctx: DwlContext, dmabufs: HashMap, dmabuf_next_id: u32, surfaces: HashMap, surface_next_id: u32, + ctx: DwlContext, } impl DisplayWl { @@ -124,11 +124,11 @@ impl DisplayWl { } Ok(DisplayWl { - ctx, dmabufs: Default::default(), dmabuf_next_id: 0, surfaces: Default::default(), surface_next_id: 0, + ctx, }) }