From aab7417cb3ca9a7c7a8798b3b3736c71bb19d419 Mon Sep 17 00:00:00 2001 From: foobarbyte <61650320+foobarbyte@users.noreply.github.com> Date: Fri, 26 Jun 2020 07:07:55 +0000 Subject: [PATCH] Fix crash on closing last active window. When on_name_changed is called, controlwindow may refer to a window that has been closed. If so, this leads to is_window_on_active_workspace_and_no_other_maximized_windows_above causing a segmentation fault when top_window turns out to be NULL. Since we would like to clear the displayed window title in this case, we should first check whether controlwindow refers to a closed window. It makes sense to do this where we already check if it is NULL or if it refers to the Desktop. We can check this by determining whether the window has a valid PID using wnck_window_get_pid. --- panel-plugin/title/windowck-title.c | 1 + 1 file changed, 1 insertion(+) diff --git a/panel-plugin/title/windowck-title.c b/panel-plugin/title/windowck-title.c index e73c2bd..b465a7b 100644 --- a/panel-plugin/title/windowck-title.c +++ b/panel-plugin/title/windowck-title.c @@ -123,6 +123,7 @@ static void on_name_changed (WnckWindow *controlwindow, WindowckPlugin *wckp) const gchar *title_text; if (controlwindow + && wnck_window_get_pid(controlwindow) // if active window has been closed, pid is 0 && ((wnck_window_get_window_type (controlwindow) != WNCK_WINDOW_DESKTOP) || wckp->prefs->show_on_desktop)) {