84 lines
2.5 KiB
Diff
84 lines
2.5 KiB
Diff
Index: kdelibs/kinit/klauncher.cpp
|
|
===================================================================
|
|
--- kdelibs/kinit/klauncher.cpp (Revision 792865)
|
|
+++ kdelibs/kinit/klauncher.cpp (Revision 792866)
|
|
@@ -231,16 +231,19 @@
|
|
{
|
|
#ifdef Q_WS_X11
|
|
if( mCached_dpy != NULL )
|
|
+ {
|
|
XCloseDisplay( mCached_dpy );
|
|
+ mCached_dpy = NULL;
|
|
+ }
|
|
#endif
|
|
}
|
|
|
|
void
|
|
-KLauncher::destruct(int exit_code)
|
|
+KLauncher::destruct()
|
|
{
|
|
if (QCoreApplication::instance()) ((KLauncher*)QCoreApplication::instance())->close();
|
|
// We don't delete the app here, that's intentional.
|
|
- ::_exit(exit_code);
|
|
+ ::_exit(255);
|
|
}
|
|
|
|
void KLauncher::setLaunchEnv(const QString &name, const QString &value)
|
|
@@ -312,7 +315,7 @@
|
|
kDebug(7016) << "Exiting on read_socket errno:" << errno;
|
|
::signal( SIGHUP, SIG_IGN);
|
|
::signal( SIGTERM, SIG_IGN);
|
|
- destruct(255); // Exit!
|
|
+ destruct(); // Exit!
|
|
}
|
|
requestData.resize(request_header.arg_length);
|
|
result = read_socket(kdeinitSocket, (char *) requestData.data(),
|
|
Index: kdelibs/kinit/klauncher_main.cpp
|
|
===================================================================
|
|
--- kdelibs/kinit/klauncher_main.cpp (Revision 792865)
|
|
+++ kdelibs/kinit/klauncher_main.cpp (Revision 792866)
|
|
@@ -35,13 +35,15 @@
|
|
#include <QtCore/QCoreApplication>
|
|
|
|
#ifndef Q_WS_WIN
|
|
+static int sigpipe[ 2 ];
|
|
static void sig_handler(int sig_num)
|
|
{
|
|
// No recursion
|
|
signal( SIGHUP, SIG_IGN);
|
|
signal( SIGTERM, SIG_IGN);
|
|
-fprintf(stderr, "klauncher: Exiting on signal %d\n", sig_num);
|
|
- KLauncher::destruct(255);
|
|
+ fprintf(stderr, "klauncher: Exiting on signal %d\n", sig_num);
|
|
+ char tmp = 'x';
|
|
+ write( sigpipe[ 1 ], &tmp, 1 );
|
|
}
|
|
#endif
|
|
|
|
@@ -103,6 +105,9 @@
|
|
QDBusConnection::sessionBus().registerObject("/", launcher);
|
|
|
|
#ifndef Q_WS_WIN
|
|
+ pipe( sigpipe );
|
|
+ QSocketNotifier* signotif = new QSocketNotifier( sigpipe[ 0 ], QSocketNotifier::Read, launcher );
|
|
+ QObject::connect( signotif, SIGNAL( activated( int )), launcher, SLOT( destruct()));
|
|
KCrash::setEmergencySaveFunction(sig_handler);
|
|
signal( SIGHUP, sig_handler);
|
|
signal( SIGPIPE, SIG_IGN);
|
|
Index: kdelibs/kinit/klauncher.h
|
|
===================================================================
|
|
--- kdelibs/kinit/klauncher.h (Revision 792865)
|
|
+++ kdelibs/kinit/klauncher.h (Revision 792866)
|
|
@@ -123,8 +123,10 @@
|
|
~KLauncher();
|
|
|
|
void close();
|
|
- static void destruct(int exit_code); // exit!
|
|
|
|
+public slots:
|
|
+ void destruct(); // exit!
|
|
+
|
|
protected:
|
|
void processDied(pid_t pid, long exitStatus);
|
|
|