workspace: Downgrade assert to warning when adding window

An extension can by accident cause us to end up in a state where we try
to add the same window to a workspace twice. When this happens we
shouldn't crash, but instead complain loudly.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/992
Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/157
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1692>
This commit is contained in:
Jonas Ådahl 2021-01-28 18:59:22 +01:00 committed by Marge Bot
parent 180e62519b
commit b55b26661f

View File

@ -369,10 +369,11 @@ void
meta_workspace_add_window (MetaWorkspace *workspace,
MetaWindow *window)
{
g_return_if_fail (g_list_find (workspace->mru_list, window) == NULL);
COGL_TRACE_BEGIN_SCOPED (MetaWorkspaceAddWindow,
"Workspace (add window)");
g_assert (g_list_find (workspace->mru_list, window) == NULL);
workspace->mru_list = g_list_prepend (workspace->mru_list, window);
workspace->windows = g_list_prepend (workspace->windows, window);