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

eric pushed a 
commit to branch 
master
in repository xfce/xfdesktop.

commit 424208b3e150c48797faeeac7693c5ad6594b3e8
Author: Eric Koegel <eric.koe...@gmail.com>
Date:   Tue Jul 18 08:56:57 2017 +0300

    Don't try to allocate all the memory (Bug #12805)
    
    When the screen is removed/killed, our grid size can go negative
    which is problematic. This patch ensures it will always be positive.
    Thanks to haarp for troubleshooting this!
---
 src/xfdesktop-icon-view.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 1aaf018..2c3eb7e 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -2575,8 +2575,8 @@ xfdesktop_setup_grids(XfdesktopIconView *icon_view)
     icon_view->priv->width = width;
     icon_view->priv->height = height;
 
-    icon_view->priv->nrows = (height - MIN_MARGIN * 2) / CELL_SIZE;
-    icon_view->priv->ncols = (width - MIN_MARGIN * 2) / CELL_SIZE;
+    icon_view->priv->nrows = MAX((height - MIN_MARGIN * 2) / CELL_SIZE, 0);
+    icon_view->priv->ncols = MAX((width - MIN_MARGIN * 2) / CELL_SIZE, 0);
 
     xrest = icon_view->priv->width - icon_view->priv->ncols * CELL_SIZE;
     if (icon_view->priv->ncols > 1) {
@@ -3362,10 +3362,11 @@ xfdesktop_grid_is_free_position(XfdesktopIconView 
*icon_view,
                                 gint16 row,
                                 gint16 col)
 {
-    g_return_val_if_fail(icon_view->priv->grid_layout != NULL, FALSE);
+    if(icon_view->priv->grid_layout == NULL) {
+        return FALSE;
+    }
 
-    if(row >= icon_view->priv->nrows
-       || col >= icon_view->priv->ncols)
+    if(row >= icon_view->priv->nrows || col >= icon_view->priv->ncols)
     {
         return FALSE;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to