2 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <restartingapplication.h>
29 RestartingApplication::RestartingApplication(Display
*display
,
32 : KUniqueApplication(display
, visual
, colormap
)
34 if (KCrash::crashHandler() == 0 ) {
35 // this means we've most likely crashed once. so let's see if we
36 // stay up for more than 2 minutes time, and if so reset the
37 // crash handler since the crash isn't a frequent offender
38 QTimer::singleShot(120000, this, SLOT(setCrashHandler()));
41 // See if a crash handler was installed. It was if the -nocrashhandler
42 // argument was given, but the app eats the kde options so we can't
43 // check that directly. If it wasn't, don't install our handler either.
48 void RestartingApplication::setCrashHandler()
50 KCrash::setEmergencySaveFunction(RestartingApplication::crashHandler
);
53 void RestartingApplication::crashHandler(int)
55 fprintf(stderr
, "krunner: crashHandler called\n");
58 system("krunner --nocrashhandler &"); // try to restart
61 #include "restartingapplication.moc"