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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2853>
This commit is contained in:
Jonas Ådahl 2022-10-18 17:01:19 +02:00 committed by Marge Bot
parent 0b325d64f4
commit e65c6f18b3
3 changed files with 14 additions and 7 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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,
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,
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,
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));