[Xfce4-commits] [xfce/xfce4-panel] 02/02: systray: Fix crash when systray is empty (Bug #13927)

noreply at xfce.org noreply at xfce.org
Sun Oct 15 21:48:14 CEST 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit 35018324b980bf1905ce85291ff7099ce8df46b1
Author: Viktor Odintsev <ninetls at xfce.org>
Date:   Fri Sep 15 07:48:52 2017 +0300

    systray: Fix crash when systray is empty (Bug #13927)
    
    Gtk-ERROR **: GtkBox child XfceSystrayBox minimum width: -1 < 0 for height 1
---
 plugins/systray/systray-box.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c
index fdafd71..e32e576 100644
--- a/plugins/systray/systray-box.c
+++ b/plugins/systray/systray-box.c
@@ -112,6 +112,7 @@ struct _SystrayBox
   guint         square_icons : 1;
 
   /* allocated size by the plugin */
+  gint          size_alloc_init;
   gint          size_alloc;
   gint          nrows;
 };
@@ -162,6 +163,7 @@ systray_box_init (SystrayBox *box)
   box->children = NULL;
   box->names_ordered = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
   box->size_max = SIZE_MAX_DEFAULT;
+  box->size_alloc_init = SIZE_MAX_DEFAULT;
   box->size_alloc = SIZE_MAX_DEFAULT;
   box->n_hidden_children = 0;
   box->n_visible_children = 0;
@@ -286,7 +288,7 @@ systray_box_get_preferred_width   (GtkWidget       *widget,
                                    gint            *minimum_width,
                                    gint            *natural_width)
 {
-  SystrayBox     *box = XFCE_SYSTRAY_BOX (widget);
+  SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
 
   if (box->horizontal)
     {
@@ -295,9 +297,9 @@ systray_box_get_preferred_width   (GtkWidget       *widget,
   else
     {
       if (minimum_width != NULL)
-        *minimum_width = -1;
+        *minimum_width = box->size_alloc_init;
       if (natural_width != NULL)
-        *natural_width = -1;
+        *natural_width = box->size_alloc_init;
     }
 }
 
@@ -308,14 +310,14 @@ systray_box_get_preferred_height  (GtkWidget       *widget,
                                    gint            *minimum_height,
                                    gint            *natural_height)
 {
-  SystrayBox     *box = XFCE_SYSTRAY_BOX (widget);
+  SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
 
   if (box->horizontal)
     {
       if (minimum_height != NULL)
-        *minimum_height = -1;
+        *minimum_height = box->size_alloc_init;
       if (natural_height != NULL)
-        *natural_height = -1;
+        *natural_height = box->size_alloc_init;
     }
   else
     {
@@ -853,6 +855,7 @@ systray_box_set_size_alloc (SystrayBox *box,
 
   if (G_LIKELY (size_alloc != box->size_alloc || nrows != box->nrows))
     {
+      box->size_alloc_init = size_alloc;
       box->size_alloc = size_alloc;
       box->nrows = nrows;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list