--- compiz-0.3.6/include/compiz.h.close-session 2006-12-27 13:28:22.000000000 -0500 +++ compiz-0.3.6/include/compiz.h 2007-03-28 22:14:27.000000000 -0400 @@ -210,6 +210,7 @@ extern Bool strictBinding; extern Bool useCow; extern Bool noDetection; +extern Bool disableSm; extern int defaultRefreshRate; extern char *defaultTextureFilter; --- compiz-0.3.6/src/display.c.close-session 2006-12-24 23:38:12.000000000 -0500 +++ compiz-0.3.6/src/display.c 2007-03-28 22:12:30.000000000 -0400 @@ -1876,6 +1876,13 @@ } } +static void prepareShutDown(void) +{ + while (popPlugin ()); + if (!disableSm) + closeSession (); +} + void eventLoop (void) { @@ -1907,11 +1914,13 @@ if (restartSignal) { + prepareShutDown (); execvp (programName, programArgv); exit (1); } else if (shutDown) { + prepareShutDown (); exit (0); } --- compiz-0.3.6/src/main.c.close-session 2007-03-28 22:12:29.000000000 -0400 +++ compiz-0.3.6/src/main.c 2007-03-28 22:14:06.000000000 -0400 @@ -81,6 +81,7 @@ Bool indirectRendering = TRUE; Bool strictBinding = TRUE; Bool noDetection = FALSE; +Bool disableSm = FALSE; #ifdef USE_COW Bool useCow = TRUE; @@ -133,7 +134,6 @@ char *displayName = 0; char *plugin[256]; int i, nPlugin = 0; - Bool disableSm = FALSE; char *clientId = NULL; programName = argv[0]; @@ -241,8 +241,5 @@ eventLoop (); - if (!disableSm) - closeSession (); - return 0; }