renderer/native: Clear old KMS updates on views rebuild
If there are any pending updates, for example if we painted one of multiple monitors but without having posted the update due to waiting for another monitor to be painted, but before we paint all of them and post the update, another hotplug event happens, we'd have stale pending KMS update. When that update eventually would be processed, we'd try to apply out-of-date updates which may contain freed memory. Fix this by discarding any update when we're rebuilding the views. We can be sure not to need any of the old updates since we're rebuilding the whole content anyway. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1928 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2216>
This commit is contained in:
parent
af08847126
commit
8e91c6295d
@ -181,6 +181,12 @@ struct _MetaKms
|
||||
|
||||
G_DEFINE_TYPE (MetaKms, meta_kms, G_TYPE_OBJECT)
|
||||
|
||||
void
|
||||
meta_kms_discard_pending_updates (MetaKms *kms)
|
||||
{
|
||||
g_clear_list (&kms->pending_updates, (GDestroyNotify) meta_kms_update_free);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_kms_add_pending_update (MetaKms *kms,
|
||||
MetaKmsUpdate *update)
|
||||
|
@ -41,6 +41,8 @@ typedef enum _MetaKmsUpdateFlag
|
||||
#define META_TYPE_KMS (meta_kms_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaKms, meta_kms, META, KMS, GObject)
|
||||
|
||||
void meta_kms_discard_pending_updates (MetaKms *kms);
|
||||
|
||||
MetaKmsUpdate * meta_kms_ensure_pending_update (MetaKms *kms,
|
||||
MetaKmsDevice *device);
|
||||
|
||||
|
@ -1391,6 +1391,7 @@ meta_renderer_native_rebuild_views (MetaRenderer *renderer)
|
||||
META_RENDERER_CLASS (meta_renderer_native_parent_class);
|
||||
|
||||
meta_kms_discard_pending_page_flips (kms);
|
||||
meta_kms_discard_pending_updates (kms);
|
||||
|
||||
keep_current_onscreens_alive (renderer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user