emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1f755a74b7: Fix a crash on some versions of GTK


From: Po Lu
Subject: master 1f755a74b7: Fix a crash on some versions of GTK
Date: Fri, 18 Feb 2022 05:04:47 -0500 (EST)

branch: master
commit 1f755a74b7a0268aad6a55764f4ceba3ba4063ff
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix a crash on some versions of GTK
    
    * src/emacsgtkfixed.c (XSetWMNormalHints): Fix potential
    arithmetic fault.
---
 src/emacsgtkfixed.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index cd5d1d1435..f2c9fa7b7d 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -183,9 +183,12 @@ XSetWMSizeHints (Display *d,
 
       if (hints->flags & PResizeInc)
        {
-         if (data[5] % hints->width_inc)
+         /* Some versions of GTK set PResizeInc even if the
+            increments are at their initial values.  */
+
+         if (hints->width_inc && data[5] % hints->width_inc)
            data[5] += (hints->width_inc - (data[5] % hints->width_inc));
-         if (data[6] % hints->height_inc)
+         if (hints->height_inc && data[6] % hints->height_inc)
            data[6] += (hints->height_inc - (data[6] % hints->height_inc));
        }
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]