[PATCH] KCrash::setEmergencySaveFunction

Aaron J. Seigo aseigo at kde.org
Thu Jan 13 07:25:43 GMT 2005


hi...

i've improved kicker's crash recovery[1] but it seems to have uncovered a bug 
in KCrash::setEmergencySaveFunction. there's a comment in there that says:

  /*
   * We need at least the default crash handler for
   * emergencySaveFunction to be called
   */

which is true: without the crashHandler, the emergencySaveFunction won't get 
called. however, while it sets _crashHandler, it never hooks it up to the 
system signals that make it actually work (e.g. SIGSEGV) and as such setting 
the emergencySaveFunction when you don't have a crash handler doesn't work. 
the following one liner fixes this handily.

are there any possible bad sideeffects or can this go in?

Index: kcrash.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kcrash.cpp,v
retrieving revision 1.46
diff -u -3 -d -p -r1.46 kcrash.cpp
--- kcrash.cpp  7 Sep 2004 11:42:16 -0000       1.46
+++ kcrash.cpp  13 Jan 2005 07:19:29 -0000
@@ -70,7 +70,7 @@ KCrash::setEmergencySaveFunction (Handle
    * emergencySaveFunction to be called
    */
   if (_emergencySaveFunction && !_crashHandler)
-    _crashHandler = defaultCrashHandler;
+    setCrashHandler();
 }

[1] up till now, kicker will only resurrect itself after the first crash. this 
prevents infinite crash recursion which is really bad when the crash is on 
startup. however, it's also not so hot when the crash is intermittent leading 
to the user not getting their kicker back after a crash just because it 
happened to crash yesterday, too.

so now, upon coming back from a crash, it sets the crash handler only after 2 
minutes of run time. any crashes that are more than 2 minutes apart will not 
prevent kicker from coming back.

-- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050113/af8eb49d/attachment.sig>


More information about the kde-core-devel mailing list