From fc5367e74deb6231244d3d989224ce3534e3a120 Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Thu, 1 Jun 2000 23:44:03 +0000 Subject: [PATCH] WABA: Restart kwin when it crashes. I hope this isn't used as excuse not to debug kwin crashes any more :-) svn path=/trunk/kdebase/kwin/; revision=51570 --- main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 567618da5e..681715c61c 100644 --- a/main.cpp +++ b/main.cpp @@ -31,7 +31,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich #include #include #include - +#include Options* options; Atoms* atoms; @@ -39,6 +39,15 @@ Atoms* atoms; Time kwin_time = CurrentTime; static bool initting = FALSE; +static DCOPClient * client = 0; + +static void crashHandler(int) +{ + KCrash::setCrashHandler(0); // Exit on next crash. + delete client; client = 0; // Unregister with dcop. + system("kwin&"); // Try to restart +} + int x11ErrorHandler(Display *d, XErrorEvent *e){ char msg[80], req[80], number[80]; bool ignore_badwindow = TRUE; //maybe temporary @@ -184,9 +193,10 @@ int main( int argc, char * argv[] ) signal(SIGHUP, SIG_IGN); Application a; + KCrash::setCrashHandler(crashHandler); // Try to restart on crash fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1); - DCOPClient * client = a.dcopClient(); + client = a.dcopClient(); client->attach(); client->registerAs("kwin", false);