From fe76e6a2282a1a22c70e00d334ded7d4dd0805af Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 17 Sep 2019 13:20:36 +0300 Subject: [PATCH] renderer/native: Reset all fields of MetaDumbBuffer release_dumb_fb () checks 'map' to see if anything needs freeing. Other places are checking fb_id instead. The checks maybe redundant, but let's reset all fields here while at it, so that all the checks work as expected. https://gitlab.gnome.org/GNOME/mutter/merge_requests/810 --- src/backends/native/meta-renderer-native.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 9bdcbd937..d7b98d397 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -2679,7 +2679,6 @@ release_dumb_fb (MetaDumbBuffer *dumb_fb, close (dumb_fb->dmabuf_fd); munmap (dumb_fb->map, dumb_fb->map_size); - dumb_fb->map = NULL; kms_fd = meta_gpu_kms_get_fd (gpu_kms); @@ -2689,6 +2688,10 @@ release_dumb_fb (MetaDumbBuffer *dumb_fb, .handle = dumb_fb->handle }; drmIoctl (kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg); + + *dumb_fb = (MetaDumbBuffer) { + .dmabuf_fd = -1, + }; } static gboolean