diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c
index a12252f957b5f5eac3bfef4e12f1123e30088a12..907470df09aa46eaffe8b721cb4c7b1a1f38ad0a 100644
--- a/thunar/thunar-location-buttons.c
+++ b/thunar/thunar-location-buttons.c
@@ -867,6 +867,9 @@ thunar_location_buttons_size_allocate (GtkWidget     *widget,
 
   if (need_sliders || buttons->fake_root_button != NULL)
     {
+      /* to avoid warnings in gtk >= 3.20 */
+      gtk_widget_get_preferred_width (buttons->left_slider, &width, NULL);
+
       child_allocation.width = buttons->slider_width;
       child_allocation.x = left_slider_offset + allocation->x;
       gtk_widget_size_allocate (buttons->left_slider, &child_allocation);