kdecore Library API Documentation

KCrash Class Reference

This class handles segmentation-faults. More...

#include <kcrash.h>

List of all members.

Public Types

typedef void(* HandlerType )(int)

Static Public Methods

void defaultCrashHandler (int signal)
void setCrashHandler (HandlerType handler=defaultCrashHandler)
HandlerType crashHandler ()
void setEmergencySaveFunction (HandlerType saveFunction=(HandlerType) 0)
HandlerType emergencySaveFunction ()
void setSafer (bool on)
void setApplicationPath (QString path)
void setApplicationName (QString name)

Static Protected Attributes

HandlerType _crashHandler = 0
HandlerType _emergencySaveFunction = 0


Detailed Description

This class handles segmentation-faults.

By default it displays a message-box saying the application crashed. This default can be overridden by setting a custom crash handler with setCrashHandler(). If a function is specified with setEmergencySaveFunction() it will be called by the default crash handler, giving the application a chance to save its data.

Definition at line 36 of file kcrash.h.


Member Typedef Documentation

typedef void(* KCrash::HandlerType)(int)
 

This function type is a pointer to a crash handler function.

The function's argument is the number of the signal.

Definition at line 54 of file kcrash.h.

Referenced by crashHandler(), and emergencySaveFunction().


Member Function Documentation

void KCrash::defaultCrashHandler int    signal [static]
 

The default crash handler.

Parameters:
signal  the signal number

Definition at line 111 of file kcrash.cpp.

References _emergencySaveFunction, KInstance::aboutData(), KAboutData::bugAddress(), DCOPClient::emergencyClose(), KNotifyClient::instance(), QString::isNull(), KAboutData::programName(), QCString::setNum(), QString::utf8(), and KAboutData::version().

Referenced by setEmergencySaveFunction().

void KCrash::setCrashHandler HandlerType    handler = defaultCrashHandler [static]
 

Install a function to be called in case a SIGSEGV is caught.

Parameters:
handler  HandlerType handler can be one of
  • null in which case signal-catching is disabled (by calling signal(SIGSEGV, SIG_DFL))
  • if handler is omitted the default crash handler is installed.
  • an user defined function in the form: static (if in a class) void myCrashHandler(int);
handler  the crash handler

Definition at line 80 of file kcrash.cpp.

References _crashHandler.

HandlerType KCrash::crashHandler   [inline, static]
 

Returns the installed crash handler.

Returns:
the crash handler

Definition at line 73 of file kcrash.h.

References _crashHandler, and HandlerType.

void KCrash::setEmergencySaveFunction HandlerType    saveFunction = (HandlerType) 0 [static]
 

Installs a function which should try to save the applications data.

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 is called.

Parameters:
saveFunction  the handler to install

Definition at line 64 of file kcrash.cpp.

References _crashHandler, _emergencySaveFunction, and defaultCrashHandler().

HandlerType KCrash::emergencySaveFunction   [inline, static]
 

Return the currently set emergency save function.

Returns:
the emergency save function

Definition at line 87 of file kcrash.h.

References _emergencySaveFunction, and HandlerType.

void KCrash::setSafer bool    on [inline, static]
 

Set whether to start drkonqi without arbitrary disk access.

Definition at line 92 of file kcrash.h.

void KCrash::setApplicationPath QString    path [inline, static]
 

Sets the application path which should be passed to Dr.

Konqi, our nice crash display application.

Parameters:
path  the application path.

Definition at line 99 of file kcrash.h.

References QString::local8Bit().

void KCrash::setApplicationName QString    name [inline, static]
 

Sets the application name name which should be passed to Dr.

Konqi, our nice crash display application.

Parameters:
name  the name of the application, as shown in Dr. Konqi

Definition at line 107 of file kcrash.h.

References QString::local8Bit().


Member Data Documentation

KCrash::HandlerType KCrash::_crashHandler = 0 [static, protected]
 

Pointer to the crash handler.

Definition at line 55 of file kcrash.cpp.

Referenced by crashHandler(), setCrashHandler(), and setEmergencySaveFunction().

KCrash::HandlerType KCrash::_emergencySaveFunction = 0 [static, protected]
 

Pointer to the emergency save function.

Definition at line 54 of file kcrash.cpp.

Referenced by defaultCrashHandler(), emergencySaveFunction(), and setEmergencySaveFunction().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun May 16 22:01:27 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003