KDEUI
Typedefs | |
typedef void(* | HandlerType )(int) |
Enumerations | |
enum | CrashFlag { KeepFDs = 1, SaferDialog = 2, AlwaysDirectly = 4, AutoRestart = 8 } |
Functions | |
HandlerType | crashHandler () |
void | defaultCrashHandler (int signal) |
HandlerType | emergencySaveFunction () |
bool | isDrKonqiEnabled () |
void | setApplicationName (const QString &name) |
void | setApplicationPath (const QString &path) |
void | setCrashHandler (HandlerType handler=defaultCrashHandler) |
void | setDrKonqiEnabled (bool enabled) |
void | setEmergencySaveFunction (HandlerType saveFunction=0) |
void | setFlags (CrashFlags flags) |
void | startProcess (int argc, const char *argv[], bool waitAndExit) |
LONG WINAPI | win32UnhandledExceptionFilter (_EXCEPTION_POINTERS *exceptionInfo) |
Detailed Description
This namespace contains functions to handle crashes.
It allows you to set a crash handler function that will be called when your application crashes and also provides a default crash handler that implements the following functionality:
- Launches the KDE crash display application (DrKonqi) to let the user report the bug and/or debug it.
- Calls an emergency save function that you can set with setEmergencySaveFunction() to attempt to save the application's data.
- Autorestarts your application.
- Note
- All the above features are optional and you need to enable them explicitly. By default, the defaultCrashHandler() will not do anything. However, if you are using KApplication, it will by default enable launching DrKonqi on crashes, unless the –nocrashhandler argument was passed on the command line or the environment variable KDE_DEBUG is set to any value.
Typedef Documentation
typedef void(* KCrash::HandlerType)(int) |
Enumeration Type Documentation
enum KCrash::CrashFlag |
Options to determine how the default crash handler should behave.
Function Documentation
KCrash::HandlerType KCrash::crashHandler | ( | ) |
Returns the installed crash handler.
- Returns
- the crash handler
Definition at line 273 of file kcrash.cpp.
void KCrash::defaultCrashHandler | ( | int | signal | ) |
The default crash handler.
Do not call this function directly. Instead, use setCrashHandler() to set it as your application's crash handler.
- Parameters
-
signal the signal number
- Note
- If you implement your own crash handler, you will have to call this function from your implementation if you want to use the features of this namespace.
Definition at line 289 of file kcrash.cpp.
KCrash::HandlerType KCrash::emergencySaveFunction | ( | ) |
Returns the currently set emergency save function.
- Returns
- the emergency save function
Definition at line 115 of file kcrash.cpp.
bool KCrash::isDrKonqiEnabled | ( | ) |
Returns true if DrKonqi is set to be launched from the crash handler or false otherwise.
- Since
- 4.5
Definition at line 221 of file kcrash.cpp.
void KCrash::setApplicationName | ( | const QString & | name | ) |
Sets the application name
which should be passed to DrKonqi, our nice crash display application.
- Parameters
-
name the name of the application, as shown in DrKonqi
Definition at line 187 of file kcrash.cpp.
void KCrash::setApplicationPath | ( | const QString & | path | ) |
Sets the application path
which should be passed to DrKonqi, our nice crash display application.
- Parameters
-
path the application path
Definition at line 161 of file kcrash.cpp.
void KCrash::setCrashHandler | ( | HandlerType | handler = defaultCrashHandler | ) |
Install a function to be called when a crash occurs.
A crash occurs when one of the following signals is caught: SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT.
- Parameters
-
handler this can be one of: - null, in which case signal catching is disabled (by setting the signal handler for the crash signals to SIG_DFL)
- a user defined function in the form: static (if in a class) void myCrashHandler(int);
- if handler is omitted, the default crash handler is installed
- Note
- If you use setDrKonqiEnabled(true), setEmergencySaveFunction(myfunc) or setFlags(AutoRestart), you do not need to call this function explicitly. The default crash handler is automatically installed by those functions if needed. However, if you set a custom crash handler, those functions will not change it.
Definition at line 227 of file kcrash.cpp.
void KCrash::setDrKonqiEnabled | ( | bool | enabled | ) |
Enables or disables launching DrKonqi from the crash handler.
By default, launching DrKonqi is disabled. However, KApplication will enable it in its constructor, so you don't need to call this function if you are using KApplication.
- Note
- It is the crash handler's responsibility to launch DrKonqi. Therefore, if no crash handler is set, this method also installs the default crash handler to ensure that DrKonqi will be launched.
- Since
- 4.5
Definition at line 204 of file kcrash.cpp.
void KCrash::setEmergencySaveFunction | ( | HandlerType | saveFunction = 0 | ) |
Installs a function which should try to save the application's data.
- Note
- It is the crash handler's responsibility to call this function. Therefore, if no crash handler is set, the default crash handler is installed to ensure the save function will be called.
- Parameters
-
saveFunction the handler to install
Definition at line 101 of file kcrash.cpp.
void KCrash::setFlags | ( | CrashFlags | flags | ) |
Set options to determine how the default crash handler should behave.
- Parameters
-
flags ORed together CrashFlags
void KCrash::startProcess | ( | int | argc, |
const char * | argv[], | ||
bool | waitAndExit | ||
) |
Definition at line 448 of file kcrash.cpp.
LONG WINAPI KCrash::win32UnhandledExceptionFilter | ( | _EXCEPTION_POINTERS * | exceptionInfo | ) |
Definition at line 475 of file kcrash.cpp.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.