Skip to content

SEGV when the side pane is hidden

In Thunar-4.15.0 (on gentoo), SEGV occurs under the following conditions.

  • last-side-pane is "void", thunar startup always failed in SEGV.
  • after startup, hide sidepane and toggle "Show Hidden Files" caused SEGV.

I tried "git bisect" and found caused commit 2f97d3e6. And I made a patch to fix this problem.

patch.diff

diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 721a7fbc273d..06cfe23913c0 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -816,7 +816,10 @@ thunar_window_init (ThunarWindow *window)
   window->bookmark_monitor = g_file_monitor_file (window->bookmark_file, G_FILE_MONITOR_NONE, NULL, NULL);
 
   /* same is done for view in thunar_window_action_view_changed */
-  thunar_side_pane_set_show_hidden (THUNAR_SIDE_PANE (window->sidepane), window->show_hidden);
+  if (G_LIKELY (window->sidepane != NULL))
+    {
+      thunar_side_pane_set_show_hidden (THUNAR_SIDE_PANE (window->sidepane), window->show_hidden);
+    }
 }
 
 
@@ -3181,7 +3184,10 @@ thunar_window_action_show_hidden (ThunarWindow *window)
 
   window->show_hidden = !window->show_hidden;
   gtk_container_foreach (GTK_CONTAINER (window->notebook), (GtkCallback) (void (*)(void)) thunar_view_set_show_hidden, GINT_TO_POINTER (window->show_hidden));
-  thunar_side_pane_set_show_hidden (THUNAR_SIDE_PANE (window->sidepane), window->show_hidden);
+  if (G_LIKELY (window->sidepane != NULL))
+    {
+      thunar_side_pane_set_show_hidden (THUNAR_SIDE_PANE (window->sidepane), window->show_hidden);
+    }
 
   g_object_set (G_OBJECT (window->preferences), "last-show-hidden", window->show_hidden, NULL);

(I created a gitlab account, but I could not create a fork repository or merge request, so I attached a patch)