generic: use KApplication::quitOnSignal() in kglobaaccel, knotify4 and kuiserver to setup signals for application quit

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-26 02:44:21 +03:00
parent e47545edf0
commit 5927adc8c7
4 changed files with 14 additions and 13 deletions

View file

@ -68,6 +68,7 @@ int main(int argc, char **argv)
// This app is started automatically, no need for session management
app.disableSessionManagement();
app.setQuitOnLastWindowClosed(false);
app.quitOnSignal();
QDBusConnection session = QDBusConnection::sessionBus();
if (!session.isConnected()) {

View file

@ -54,6 +54,7 @@ int main(int argc, char **argv)
// in which case there is a deadlock with ksmserver waiting for knotify to finish
// startup and knotify waiting to register with ksmserver
app.disableSessionManagement();
app.quitOnSignal();
QDBusConnection session = QDBusConnection::sessionBus();
if (!session.isConnected()) {

View file

@ -46,7 +46,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
@ -65,7 +64,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <QRegExp>
#include <QtDBus/QtDBus>
#include <QSocketNotifier>
#include <QtCore/qfileinfo.h>
#include <QtCore/QFileInfo>
#include <QtGui/qx11info_x11.h>
#include <kaction.h>
#include <kactioncollection.h>
@ -81,13 +81,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <kprocess.h>
#include <kdebug.h>
#include <kshell.h>
#include "moc_server.cpp"
#include <kworkspace/kdisplaymanager.h>
#include <QtGui/qx11info_x11.h>
#include <krandom.h>
#include <klauncher_iface.h>
#include <kde_file.h>
KSMServer* the_server = 0;
@ -706,10 +703,9 @@ KSMServer::KSMServer( const QString& windowManager, bool _only_local, bool locks
connect( con, SIGNAL(activated(int)), this, SLOT(newConnection(int)) );
}
signal(SIGHUP, sighandler);
signal(SIGTERM, sighandler);
signal(SIGINT, sighandler);
signal(SIGPIPE, SIG_IGN);
KDE_signal(SIGHUP, sighandler);
KDE_signal(SIGTERM, sighandler);
KDE_signal(SIGINT, sighandler);
connect( &protectionTimer, SIGNAL(timeout()), this, SLOT(protectionTimeout()) );
connect( &restoreTimer, SIGNAL(timeout()), this, SLOT(tryRestoreNext()) );
@ -743,14 +739,14 @@ void KSMServer::cleanUp()
::unlink(fName.data());
FreeAuthenticationData(numTransports, authDataEntries);
signal(SIGTERM, SIG_DFL);
signal(SIGINT, SIG_DFL);
KDE_signal(SIGTERM, SIG_DFL);
KDE_signal(SIGINT, SIG_DFL);
KDisplayManager().shutdown( shutdownType, shutdownMode );
}
void* KSMServer::watchConnection( IceConn iceConn )
{
KSMConnection* conn = new KSMConnection( iceConn );
@ -1067,3 +1063,5 @@ void KSMServer::rebootWithoutConfirmation()
{
shutdown(KWorkSpace::ShutdownConfirmNo, KWorkSpace::ShutdownTypeReboot, KWorkSpace::ShutdownModeDefault);
}
#include "moc_server.cpp"

View file

@ -53,6 +53,7 @@ int main(int argc, char **argv)
// This app is started automatically, no need for session management
app.disableSessionManagement();
app.setQuitOnLastWindowClosed(false);
app.quitOnSignal();
QDBusConnection session = QDBusConnection::sessionBus();
if (!session.isConnected()) {