kdeui: implement KCrash::NoRestart flag

for programs that cannot be restarted by simply exec-ing them such as the
KIO slaves which require application socket as argument

note that restarting is maybe works thing - programs started by kdesudo
cannot be restarted (properly) as they are exec-ed by other program that
does the setup for them to function the way they should

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-08 00:35:04 +02:00
parent 936cc87544
commit 6c98720e24
3 changed files with 8 additions and 2 deletions

View file

@ -138,6 +138,10 @@ void KCrash::defaultCrashHandler(int sig)
systemargs.append(QByteArray::number(QCoreApplication::applicationPid()));
systemargs.append("\"");
if (s_flags & KCrash::NoRestart) {
systemargs.append(" --restarted");
}
const KComponentData kcomponentdata = KGlobal::mainComponent();
const KAboutData *kaboutdata = kcomponentdata.isValid() ? kcomponentdata.aboutData() : nullptr;
if (kaboutdata) {

View file

@ -84,10 +84,12 @@ namespace KCrash
/**
* Options to determine how the default crash handler should behave.
* @note AutoRestart takes priority over the other options even if they are set
*/
enum CrashFlag {
AutoRestart = 1, ///< autorestart this application. Only sensible for KUniqueApplications. @since 4.1.
DrKonqi = 2 ///< launchers DrKonqi. @since 4.23.
DrKonqi = 2, ///< launchers DrKonqi. @since 4.23.
NoRestart = 4 ///< tell DrKonqi not to restart the program. @since 4.23.
};
Q_DECLARE_FLAGS(CrashFlags, CrashFlag)

View file

@ -208,7 +208,7 @@ SlaveBase::SlaveBase( const QByteArray &protocol,
{
if (qgetenv("KDE_DEBUG").isEmpty())
{
KCrash::setFlags(KCrash::flags() | KCrash::DrKonqi);
KCrash::setFlags(KCrash::flags() | KCrash::DrKonqi | KCrash::NoRestart);
}
struct sigaction act;