From: pancake@nopcode.org Date: Tue, 31 Aug 2010 09:40:57 +0000 (+0200) Subject: fix crash for small windows X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=23cc3fc5715a650c91e3b99074c31aaf63e2102c;p=st.git fix crash for small windows use unconditional infinite loops --- diff --git a/st.c b/st.c index 6a90176..7567e57 100644 --- a/st.c +++ b/st.c @@ -1422,6 +1422,10 @@ resize(XEvent *e) { tresize(col, row); ttyresize(col, row); XFreePixmap(xw.dis, xw.buf); + if(xw.bufh<1) + xw.bufh = 1; + if(xw.bufw<1) + xw.bufw = 1; xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); draw(SCREEN_REDRAW); } @@ -1436,7 +1440,7 @@ run(void) { XSelectInput(xw.dis, xw.win, mask); XResizeWindow(xw.dis, xw.win, xw.w, xw.h); /* XXX: fix resize bug in wmii (?) */ - while(1) { + for(;;) { FD_ZERO(&rfd); FD_SET(cmdfd, &rfd); FD_SET(xfd, &rfd);