Skip to content

Commit a4056ac

Browse files
authored
Merge pull request #498 from Jafaral/fix-wclose
runtime: fix null pointer deference on a window close
2 parents 10dbbd3 + 6d50011 commit a4056ac

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/runtime/rxwin.ri

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -831,19 +831,20 @@ int handle_misc(wdp wd, wbp w)
831831
*/
832832
struct descrip d;
833833
int ret = 0;
834-
if (w && (evwin == w->window->win)) ret = 1;
835-
if (ws->inputmask & WindowClosureMask) {
836-
MakeInt(WINDOWCLOSED, &d);
837-
qevent(wb->window, &d, 0, 0, 0, 0);
834+
if (w && (evwin == w->window->win))
835+
ret = 1;
836+
MakeInt(WINDOWCLOSED, &d);
837+
qevent(ws, &d, 0, 0, 0, 0);
838+
if (ws->inputmask & WindowClosureMask)
838839
return 1;
839-
}
840+
840841
SETCLOSED((wbp)wb);
841842
wclose(wb);
842-
MakeInt(WINDOWCLOSED, &d);
843-
qevent(wb->window, &d, 0, 0, 0, 0);
844843
BlkD(lastEventWin,File)->status &= ~(Fs_Write);
845-
if (ret) return 1;
846-
break;
844+
if (ret)
845+
return 1;
846+
else
847+
break;
847848
}
848849
case DestroyNotify:
849850
if (!ISZOMBIE(wb)) return -1; /* error #141 */

0 commit comments

Comments
 (0)