# richard.coe@med.ge.com GSAge16522 Xorg crash when closing down appgroup process # 20 Nov 2009 # This patch fixes a crash in the Xorg server when the appgroup leader has exited and # windows from the appgroup session are left open and eventually close. # The issue is caused when windows in the appgroup are not correctly inserted into the # appgroup list. Since they are not in the list, the windows do not get closed at # appgroup shutdown. # # I was able to reproduce this with two scripts: # script: xltest # while : ; do ./xlaunch -- ./xtest1 & sleep 1 ; kill $! ; done # script: xtest1 # let i=0 ; while ((i < 20)) ; do xterm -geometry =20x20 & let i=$i + 1 ; done # diff -urNp ../xorg-server-1.5.2-old/Xext/appgroup.c Xext/appgroup.c --- ../xorg-server-1.5.2-old/Xext/appgroup.c 2008-10-10 13:12:48.000000000 -0500 +++ Xext/appgroup.c 2009-11-20 13:57:23.000000000 -0600 @@ -142,10 +142,11 @@ static void XagClientStateChange( if (pAppGrp->nclients != 0) { /* if this client already in AppGroup, don't add it again */ int i; - for (i = 0; i < pAppGrp->nclients; i++) + for (i = 0; i < pAppGrp->nclients; i++) { if (pClient == pAppGrp->clients[i]) return; if (slot == -1 && pAppGrp->clients[i] == NULL) slot = i; + } } if (slot == -1) { slot = pAppGrp->nclients++;