color-device: Make it possible to outlive the active monitors

Previously the color device was destroyed when it was attached to a
monitor that was going away. However, the MetaMonitor objects are
ref-counted and can stay around for longer, even if the underlying
resources went away. We need color devices for as long as the
MetaMonitors are alive.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3904>
This commit is contained in:
Sebastian Wick
2024-07-18 16:24:34 +02:00
parent a10b56e946
commit 431c4d12b9
4 changed files with 5 additions and 11 deletions

View File

@ -165,7 +165,8 @@ update_devices (MetaColorManager *color_manager)
devices = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
(GDestroyNotify) meta_color_device_destroy);
(GDestroyNotify) g_object_unref);
for (l = meta_monitor_manager_get_monitors (monitor_manager); l; l = l->next)
{
MetaMonitor *monitor = META_MONITOR (l->data);