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 <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
This commit is contained in:
Jason Macnak 2020-09-16 14:19:21 -07:00 committed by Commit Bot
parent b4b94c7d64
commit b3c70d2b46

View file

@ -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<u32, DwlDmabuf>,
dmabuf_next_id: u32,
surfaces: HashMap<u32, Surface>,
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,
})
}