From e65c6f18b3d6c84ebed1cb570fe96dcf523ee5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 18 Oct 2022 17:01:19 +0200 Subject: [PATCH] tests/kms: Don't leak MetaKmsFeedback Also start warning if we don't handle the meta_kms_device_process_update_sync() return value. Part-of: --- src/backends/native/meta-kms-device.h | 3 ++- src/backends/native/meta-kms-update.h | 1 + src/tests/native-kms-device.c | 17 +++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/backends/native/meta-kms-device.h b/src/backends/native/meta-kms-device.h index 6eeb84cec..3f400ceab 100644 --- a/src/backends/native/meta-kms-device.h +++ b/src/backends/native/meta-kms-device.h @@ -75,7 +75,8 @@ GList * meta_kms_device_get_fallback_modes (MetaKmsDevice *device); META_EXPORT_TEST MetaKmsFeedback * meta_kms_device_process_update_sync (MetaKmsDevice *device, MetaKmsUpdate *update, - MetaKmsUpdateFlag flags); + MetaKmsUpdateFlag flags) + G_GNUC_WARN_UNUSED_RESULT; META_EXPORT_TEST void meta_kms_device_disable (MetaKmsDevice *device); diff --git a/src/backends/native/meta-kms-update.h b/src/backends/native/meta-kms-update.h index fdb964327..69ff40986 100644 --- a/src/backends/native/meta-kms-update.h +++ b/src/backends/native/meta-kms-update.h @@ -81,6 +81,7 @@ typedef struct _MetaKmsPlaneFeedback typedef void (* MetaKmsResultListenerFunc) (const MetaKmsFeedback *feedback, gpointer user_data); +META_EXPORT_TEST void meta_kms_feedback_free (MetaKmsFeedback *feedback); MetaKmsFeedbackResult meta_kms_feedback_get_result (const MetaKmsFeedback *feedback); diff --git a/src/tests/native-kms-device.c b/src/tests/native-kms-device.c index 0eb85b708..6124686f8 100644 --- a/src/tests/native-kms-device.c +++ b/src/tests/native-kms-device.c @@ -274,6 +274,7 @@ meta_test_kms_device_mode_set (void) MetaKmsCrtcState crtc_state; MetaKmsConnectorState connector_state; MetaRectangle mode_rect; + MetaKmsFeedback *feedback; device = meta_get_test_kms_device (test_context); crtc = meta_get_test_kms_crtc (device); @@ -296,8 +297,9 @@ meta_test_kms_device_mode_set (void) meta_get_mode_fixed_rect_16 (mode), meta_get_mode_rect (mode), META_KMS_ASSIGN_PLANE_FLAG_NONE); - meta_kms_device_process_update_sync (device, update, - META_KMS_UPDATE_FLAG_NONE); + feedback = meta_kms_device_process_update_sync (device, update, + META_KMS_UPDATE_FLAG_NONE); + meta_kms_feedback_free (feedback); meta_kms_update_free (update); g_assert_nonnull (meta_kms_crtc_get_current_state (crtc)); @@ -329,6 +331,7 @@ meta_test_kms_device_power_save (void) { MetaKmsDevice *device; MetaKmsUpdate *update; + MetaKmsFeedback *feedback; MetaKmsCrtc *crtc; MetaKmsConnector *connector; MetaKmsMode *mode; @@ -359,8 +362,9 @@ meta_test_kms_device_power_save (void) meta_get_mode_fixed_rect_16 (mode), meta_get_mode_rect (mode), META_KMS_ASSIGN_PLANE_FLAG_NONE); - meta_kms_device_process_update_sync (device, update, - META_KMS_UPDATE_FLAG_NONE); + feedback = meta_kms_device_process_update_sync (device, update, + META_KMS_UPDATE_FLAG_NONE); + meta_kms_feedback_free (feedback); meta_kms_update_free (update); g_assert_true (meta_kms_crtc_is_active (crtc)); @@ -396,8 +400,9 @@ meta_test_kms_device_power_save (void) meta_get_mode_fixed_rect_16 (mode), meta_get_mode_rect (mode), META_KMS_ASSIGN_PLANE_FLAG_NONE); - meta_kms_device_process_update_sync (device, update, - META_KMS_UPDATE_FLAG_NONE); + feedback = meta_kms_device_process_update_sync (device, update, + META_KMS_UPDATE_FLAG_NONE); + meta_kms_feedback_free (feedback); meta_kms_update_free (update); g_assert_true (meta_kms_crtc_is_active (crtc));