• R/O
  • HTTP
  • SSH
  • HTTPS

kdelibs: Commit

Katana libraries


Commit MetaInfo

Revision7cfcbc37756b999d4a312c640814da8c5a4965e0 (tree)
Time2022-12-09 19:28:21
AuthorIvailo Monev <xakepa10@gmai...>
CommiterIvailo Monev

Log Message

kdeui: new KCrash::Backtrace to log backtraces

for programs that cannot call drkonqi to show backtrace (such as
ksmserver or any non-GUI D-Bus service)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>

Change Summary

Incremental Difference

--- a/kdeui/util/kcrash.cpp
+++ b/kdeui/util/kcrash.cpp
@@ -58,7 +58,7 @@ static const int s_signals[] = {
5858 void KCrash::setFlags(KCrash::CrashFlags flags)
5959 {
6060 s_flags = flags;
61- if (s_flags & KCrash::AutoRestart || s_flags & KCrash::DrKonqi) {
61+ if (s_flags & KCrash::AutoRestart || s_flags & KCrash::DrKonqi || s_flags & KCrash::Backtrace) {
6262 // Default crash handler is required for the flags to work but one may be set already
6363 if (!s_crashHandler) {
6464 KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde");
@@ -166,7 +166,7 @@ void KCrash::defaultCrashHandler(int sig)
166166 }
167167
168168 ::system(systemargs.constData());
169- } else {
169+ } else if (s_flags & KCrash::Backtrace) {
170170 // NOTE: if HAVE_BACKTRACE is not defined kBacktrace() will return empty string
171171 #ifdef HAVE_BACKTRACE
172172 kError() << QCoreApplication::applicationName() << "crashed:\n" << kBacktrace();
--- a/kdeui/util/kcrash.h
+++ b/kdeui/util/kcrash.h
@@ -84,12 +84,14 @@ namespace KCrash
8484
8585 /**
8686 * Options to determine how the default crash handler should behave.
87- * @note AutoRestart takes priority over the other options even if they are set
87+ * @note Options are prioritised in their numerical order, i.e. if
88+ * AutoRestart is set all other options are ignored.
8889 */
8990 enum CrashFlag {
9091 AutoRestart = 1, ///< autorestart this application. Only sensible for KUniqueApplications. @since 4.1.
9192 DrKonqi = 2, ///< launchers DrKonqi. @since 4.23.
92- NoRestart = 4 ///< tell DrKonqi not to restart the program. @since 4.23.
93+ NoRestart = 4, ///< tell DrKonqi not to restart the program. @since 4.23.
94+ Backtrace = 8 ///< log backtrace if the program crashes. @since 4.23.
9395 };
9496 Q_DECLARE_FLAGS(CrashFlags, CrashFlag)
9597
Show on old repository browser