From b004fbafa92b03e7c55d3115329256224279ef21 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 25 Jul 2013 15:47:23 -0500 Subject: Fix ksmserver crash when logout dialog is disabled --- ksmserver/shutdown.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index d09383fcd..9adad413a 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -570,10 +570,12 @@ void KSMServer::handleProtectionTimeout() SHUTDOWN_MARKER("handleProtectionTimeout"); notificationTimer.stop(); - static_cast(shutdownNotifierIPDlg)->hideNotificationActionButtons(); - disconnect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); - disconnect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); - static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Forcing interacting application termination").append("...")); + if (shutdownNotifierIPDlg) { + static_cast(shutdownNotifierIPDlg)->hideNotificationActionButtons(); + disconnect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); + disconnect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); + static_cast(shutdownNotifierIPDlg)->setStatusMessage(i18n("Forcing interacting application termination").append("...")); + } for ( KSMClient* c = clients.first(); c; c = clients.next() ) { if ( !c->saveYourselfDone && !c->waitForPhase2 ) { @@ -586,10 +588,12 @@ void KSMServer::handleProtectionTimeout() void KSMServer::notificationTimeout() { - // Display the buttons in the logout dialog - connect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); - connect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); - static_cast(shutdownNotifierIPDlg)->showNotificationActionButtons(); + if (shutdownNotifierIPDlg) { + // Display the buttons in the logout dialog + connect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); + connect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); + static_cast(shutdownNotifierIPDlg)->showNotificationActionButtons(); + } } void KSMServer::completeShutdownOrCheckpoint() @@ -638,9 +642,11 @@ void KSMServer::completeShutdownOrCheckpoint() } notificationTimer.stop(); - static_cast(shutdownNotifierIPDlg)->hideNotificationActionButtons(); - disconnect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); - disconnect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); + if (shutdownNotifierIPDlg) { + static_cast(shutdownNotifierIPDlg)->hideNotificationActionButtons(); + disconnect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); + disconnect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); + } // synchronize any folders that were requested for shutdown sync if (shutdownNotifierIPDlg) { -- cgit v1.2.3