Re: [hackers] [st][PATCH] Set minimum window size to avoid crash when resizing out of bounds

From: Michael Buch <michaelbuch12_AT_gmail.com>
Date: Thu, 17 May 2018 13:07:08 +0100

Resized the terminal window inwards until it crashed. Using floating window
on dwm it didnt consistently crash. I was using xfce however.

On Thu, 17 May 2018 at 13:04, Hiltjo Posthuma <hiltjo_AT_codemadness.org>
wrote:

> On Wed, May 16, 2018 at 09:36:03PM +0100, michaelbuch12_AT_gmail.com wrote:
> > From: Michael Buch <michaelbuch12_AT_gmail.com>
> >
> > The termianl window is created without lower/upper bounds for window
> width/height. On resizing the terminal to a size of 1x1 or below we crash.
> This patch sets the minimum window height and width to prevent resizing
> past this size thus handling the scenario similar to other terminals.
> > ---
> > x.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/x.c b/x.c
> > index c0bd890..00ea444 100644
> > --- a/x.c
> > +++ b/x.c
> > _AT__AT_ -788,15 +788,17 @@ xhints(void)
> >
> > sizeh = XAllocSizeHints();
> >
> > - sizeh->flags = PSize | PResizeInc | PBaseSize;
> > + sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
> > sizeh->height = win.h;
> > sizeh->width = win.w;
> > sizeh->height_inc = win.ch;
> > sizeh->width_inc = win.cw;
> > sizeh->base_height = 2 * borderpx;
> > sizeh->base_width = 2 * borderpx;
> > + sizeh->min_height = 2 * win.ch;
> > + sizeh->min_width = 2 * win.cw;
> > if (xw.isfixed) {
> > - sizeh->flags |= PMaxSize | PMinSize;
> > + sizeh->flags |= PMaxSize;
> > sizeh->min_width = sizeh->max_width = win.w;
> > sizeh->min_height = sizeh->max_height = win.h;
> > }
> > --
> > 2.17.0
> >
> >
>
> How do you reproduce the crash?
>
> --
> Kind regards,
> Hiltjo
>
>
Received on Thu May 17 2018 - 14:07:08 CEST

This archive was generated by hypermail 2.3.0 : Thu May 17 2018 - 14:12:29 CEST