Commit 4c29ef55 authored by Simon McVittie's avatar Simon McVittie

ShellApp: Defend against running_state->windows being empty

Previously, it was treated as an invariant that whenever
app->running_state was non-NULL, app->running_state->windows was also
non-NULL.

However, on #750 and #822, we see that the backtraces for GNOME Shell
3.30.x contain _shell_app_remove_window() line 1110. In 3.30.x,
that line is at a point in _shell_app_remove_window() where the
app->running_state->windows invariant does not hold: window has already
been removed from app->running_state->windows, but app->running_state
has not yet been cleared. (The same applies in 3.32.x, but with
different line numbers.)
Signed-off-by: 's avatarSimon McVittie <smcv@debian.org>
Closes: GNOME/gnome-shell#750
Closes: GNOME/gnome-shell#822
parent 4e5ca6d3
Pipeline #75760 passed with stages
in 4 minutes and 8 seconds
......@@ -170,11 +170,8 @@ static MetaWindow *
window_backed_app_get_window (ShellApp *app)
{
g_assert (app->info == NULL);
if (app->running_state)
{
g_assert (app->running_state->windows);
return app->running_state->windows->data;
}
if (app->running_state && app->running_state->windows)
return app->running_state->windows->data;
else
return NULL;
}
......@@ -910,7 +907,10 @@ shell_app_on_user_time_changed (MetaWindow *window,
GParamSpec *pspec,
ShellApp *app)
{
/* We only connect this signal handler on windows that exist in
* running_state->windows */
g_assert (app->running_state != NULL);
g_assert (app->running_state->windows != NULL);
/* Ideally we don't want to emit windows-changed if the sort order
* isn't actually changing. This check catches most of those.
......@@ -1482,7 +1482,7 @@ shell_app_dispose (GObject *object)
g_clear_object (&app->info);
while (app->running_state)
while (app->running_state && app->running_state->windows)
_shell_app_remove_window (app, app->running_state->windows->data);
/* We should have been transitioned when we removed all of our windows */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment