From: Po Lu Date: Fri, 18 Feb 2022 10:01:58 +0000 (+0800) Subject: Fix a crash on some versions of GTK X-Git-Tag: emacs-29.0.90~2246 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1f755a74b7a0268aad6a55764f4ceba3ba4063ff;p=emacs.git Fix a crash on some versions of GTK * src/emacsgtkfixed.c (XSetWMNormalHints): Fix potential arithmetic fault. --- diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index cd5d1d14353..f2c9fa7b7db 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)); } }