From c4c29246f96ff959db7054c60d9aa76fb45b9e91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 24 Jul 2019 15:41:14 +0200
Subject: [PATCH 21/28] monitor: Use delete link to free the tiled modes while
iterating
We iterate over a temporary list of tiled modes when adding them, but the list
isn't free'd during the iteration.
So use GList's delete_link instead of remove_link.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
---
src/backends/meta-monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index ec583aa13..ff959b3bc 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -901,61 +901,61 @@ generate_tiled_monitor_modes (MetaMonitorTiled *monitor_tiled)
main_output = meta_monitor_get_main_output (META_MONITOR (monitor_tiled));
for (i = 0; i < main_output->n_modes; i++)
{
MetaCrtcMode *reference_crtc_mode = main_output->modes[i];
MetaMonitorMode *mode;
gboolean is_preferred;
if (!is_crtc_mode_tiled (main_output, reference_crtc_mode))
continue;
mode = create_tiled_monitor_mode (monitor_tiled, reference_crtc_mode,
&is_preferred);
if (!mode)
continue;
tiled_modes = g_list_append (tiled_modes, mode);
if (is_monitor_mode_assigned (monitor, mode))
monitor_priv->current_mode = mode;
if (is_preferred)
monitor_priv->preferred_mode = mode;
}
while ((l = tiled_modes))
{
MetaMonitorMode *mode = l->data;
- tiled_modes = g_list_remove_link (tiled_modes, l);
+ tiled_modes = g_list_delete_link (tiled_modes, l);
if (!meta_monitor_add_mode (monitor, mode, FALSE))
{
meta_monitor_mode_free (mode);
continue;
}
if (!monitor_priv->preferred_mode)
{
if (!best_mode ||
mode->spec.refresh_rate > best_mode->spec.refresh_rate)
best_mode = mode;
}
}
if (best_mode)
monitor_priv->preferred_mode = best_mode;
}
static MetaMonitorMode *
create_untiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
MetaOutput *main_output,
MetaCrtcMode *crtc_mode)
{
MetaMonitor *monitor = META_MONITOR (monitor_tiled);
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaMonitorModeTiled *mode;
GList *l;
int i;
--
2.26.2