Rename KCrash to avoid conflicts with KDE4

pull/16/head
Timothy Pearson 12 years ago
parent a07501e296
commit 4b3606f910

@ -21,7 +21,7 @@ v1.0:
<IncludeRules context="oneliners" /> <IncludeRules context="oneliners" />
</context> </context>
<context name="oneliners" attribute="Normal" lineEndContext="#pop"> <context name="oneliners" attribute="Normal" lineEndContext="#pop">
<StringDetect attribute="Crash" context="#stay" String="[KCrash Handler]" /> <StringDetect attribute="Crash" context="#stay" String="[TDECrash Handler]" />
<StringDetect String="Thread" firstNonSpace="true" context="thread" /> <StringDetect String="Thread" firstNonSpace="true" context="thread" />
<StringDetect String="[Current thread" firstNonSpace="true" context="thread" /> <StringDetect String="[Current thread" firstNonSpace="true" context="thread" />
</context> </context>

@ -450,7 +450,7 @@ tqWarning("Last DCOP call before KDED crash was from application '%s'\n"
void Kded::installCrashHandler() void Kded::installCrashHandler()
{ {
KCrash::setEmergencySaveFunction(crashHandler); TDECrash::setEmergencySaveFunction(crashHandler);
} }
void Kded::recreate() void Kded::recreate()

@ -759,9 +759,9 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
} }
#endif #endif
KCrash::setCrashHandler(KCrash::defaultCrashHandler); TDECrash::setCrashHandler(TDECrash::defaultCrashHandler);
KCrash::setEmergencySaveFunction(crashHandler); TDECrash::setEmergencySaveFunction(crashHandler);
KCrash::setApplicationName(TQString(appName)); TDECrash::setApplicationName(TQString(appName));
// this program is in tdelibs so it uses tdelibs as catalog // this program is in tdelibs so it uses tdelibs as catalog
TDELocale::setMainCatalogue("tdelibs"); TDELocale::setMainCatalogue("tdelibs");

@ -105,7 +105,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char**argv )
launcher->dcopClient()->setDefaultObject( name ); launcher->dcopClient()->setDefaultObject( name );
launcher->dcopClient()->setDaemonMode( true ); launcher->dcopClient()->setDaemonMode( true );
KCrash::setEmergencySaveFunction(sig_handler); TDECrash::setEmergencySaveFunction(sig_handler);
signal( SIGHUP, sig_handler); signal( SIGHUP, sig_handler);
signal( SIGPIPE, SIG_IGN); signal( SIGPIPE, SIG_IGN);
signal( SIGTERM, sig_handler); signal( SIGTERM, sig_handler);

@ -100,7 +100,7 @@ KDE_EXPORT int main(int argc, char *argv[])
TDEApplication app; TDEApplication app;
KCrash::setCrashHandler( crashHandler ); TDECrash::setCrashHandler( crashHandler );
TDEGlobal::locale()->insertCatalogue("klock"); TDEGlobal::locale()->insertCatalogue("klock");
TDEGlobal::locale()->insertCatalogue("tdescreensaver"); TDEGlobal::locale()->insertCatalogue("tdescreensaver");

@ -266,7 +266,7 @@ TDEAboutData::internalProgramName() const
return mProgramName; return mProgramName;
} }
// KCrash should call as few things as possible and should avoid e.g. malloc() // TDECrash should call as few things as possible and should avoid e.g. malloc()
// because it may deadlock. Since i18n() needs it, when TDELocale is available // because it may deadlock. Since i18n() needs it, when TDELocale is available
// the i18n() call will be done here in advance. // the i18n() call will be done here in advance.
void void

@ -1646,10 +1646,10 @@ void TDEApplication::parseCommandLine( )
if (!nocrashhandler && args->isSet("crashhandler")) if (!nocrashhandler && args->isSet("crashhandler"))
{ {
// set default crash handler / set emergency save function to nothing // set default crash handler / set emergency save function to nothing
KCrash::setCrashHandler(KCrash::defaultCrashHandler); TDECrash::setCrashHandler(TDECrash::defaultCrashHandler);
KCrash::setEmergencySaveFunction(NULL); TDECrash::setEmergencySaveFunction(NULL);
KCrash::setApplicationName(TQString(args->appName())); TDECrash::setApplicationName(TQString(args->appName()));
} }
#ifdef Q_WS_X11 #ifdef Q_WS_X11

@ -57,17 +57,17 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#endif #endif
KCrash::HandlerType KCrash::_emergencySaveFunction = 0; TDECrash::HandlerType TDECrash::_emergencySaveFunction = 0;
KCrash::HandlerType KCrash::_crashHandler = 0; TDECrash::HandlerType TDECrash::_crashHandler = 0;
const char *KCrash::appName = 0; const char *TDECrash::appName = 0;
const char *KCrash::appPath = 0; const char *TDECrash::appPath = 0;
bool KCrash::safer = false; bool TDECrash::safer = false;
// This function sets the function which should be called when the // This function sets the function which should be called when the
// application crashes and the // application crashes and the
// application is asked to try to save its data. // application is asked to try to save its data.
void void
KCrash::setEmergencySaveFunction (HandlerType saveFunction) TDECrash::setEmergencySaveFunction (HandlerType saveFunction)
{ {
_emergencySaveFunction = saveFunction; _emergencySaveFunction = saveFunction;
@ -83,7 +83,7 @@ KCrash::setEmergencySaveFunction (HandlerType saveFunction)
// This function sets the function which should be responsible for // This function sets the function which should be responsible for
// the application crash handling. // the application crash handling.
void void
KCrash::setCrashHandler (HandlerType handler) TDECrash::setCrashHandler (HandlerType handler)
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
if (!handler) if (!handler)
@ -116,7 +116,7 @@ KCrash::setCrashHandler (HandlerType handler)
} }
void void
KCrash::defaultCrashHandler (int sig) TDECrash::defaultCrashHandler (int sig)
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
// WABA: Do NOT use kdDebug() in this function because it is much too risky! // WABA: Do NOT use kdDebug() in this function because it is much too risky!
@ -148,10 +148,10 @@ KCrash::defaultCrashHandler (int sig)
if (appName) if (appName)
{ {
#ifndef NDEBUG #ifndef NDEBUG
fprintf(stderr, "[kcrash] KCrash: crashing... crashRecursionCounter = %d\n", crashRecursionCounter); fprintf(stderr, "[kcrash] TDECrash: crashing... crashRecursionCounter = %d\n", crashRecursionCounter);
fprintf(stderr, "[kcrash] KCrash: Application Name = %s path = %s pid = %d\n", appName ? appName : "<unknown>" , appPath ? appPath : "<unknown>", getpid()); fprintf(stderr, "[kcrash] TDECrash: Application Name = %s path = %s pid = %d\n", appName ? appName : "<unknown>" , appPath ? appPath : "<unknown>", getpid());
#else #else
fprintf(stderr, "[kcrash] KCrash: Application '%s' crashing...\n", appName ? appName : "<unknown>"); fprintf(stderr, "[kcrash] TDECrash: Application '%s' crashing...\n", appName ? appName : "<unknown>");
#endif #endif
const char * argv[24]; // don't forget to update this const char * argv[24]; // don't forget to update this
@ -254,7 +254,7 @@ static int write_socket(int sock, char *buffer, int len);
static int read_socket(int sock, char *buffer, int len); static int read_socket(int sock, char *buffer, int len);
static int openSocket(); static int openSocket();
void KCrash::startDrKonqi( const char* argv[], int argc ) void TDECrash::startDrKonqi( const char* argv[], int argc )
{ {
int socket = openSocket(); int socket = openSocket();
if( socket < -1 ) if( socket < -1 )
@ -277,7 +277,7 @@ void KCrash::startDrKonqi( const char* argv[], int argc )
int len = strlen( argv[ i ] ) + 1; // include terminating \0 int len = strlen( argv[ i ] ) + 1; // include terminating \0
if( pos + len > BUFSIZE ) if( pos + len > BUFSIZE )
{ {
fprintf( stderr, "[kcrash] BUFSIZE in KCrash not big enough!\n" ); fprintf( stderr, "[kcrash] BUFSIZE in TDECrash not big enough!\n" );
startDirectly( argv, argc ); startDirectly( argv, argc );
return; return;
} }
@ -315,9 +315,9 @@ void KCrash::startDrKonqi( const char* argv[], int argc )
} }
// If we can't reach tdeinit we can still at least try to fork() // If we can't reach tdeinit we can still at least try to fork()
void KCrash::startDirectly( const char* argv[], int ) void TDECrash::startDirectly( const char* argv[], int )
{ {
fprintf( stderr, "[kcrash] KCrash cannot reach tdeinit, launching directly.\n" ); fprintf( stderr, "[kcrash] TDECrash cannot reach tdeinit, launching directly.\n" );
pid_t pid = fork(); pid_t pid = fork();
if (pid <= 0) if (pid <= 0)
{ {

@ -34,7 +34,7 @@
* be called by the default crash handler, giving the application a chance * be called by the default crash handler, giving the application a chance
* to save its data. * to save its data.
*/ */
class TDECORE_EXPORT KCrash class TDECORE_EXPORT TDECrash
{ {
private: // ;o) private: // ;o)
static const char *appName; static const char *appName;

@ -40,12 +40,12 @@
typedef TQMap<TQString, TQString> ViewMap; typedef TQMap<TQString, TQString> ViewMap;
// KDE 4.0: remove this BC keeping stub // KDE 4.0: remove this BC keeping stub
void KCrashBookmarkImporter::parseCrashLog( TQString /*filename*/, bool /*del*/ ) void TDECrashBookmarkImporter::parseCrashLog( TQString /*filename*/, bool /*del*/ )
{ {
; ;
} }
ViewMap KCrashBookmarkImporterImpl::parseCrashLog_noemit( const TQString & filename, bool del ) ViewMap TDECrashBookmarkImporterImpl::parseCrashLog_noemit( const TQString & filename, bool del )
{ {
static const int g_lineLimit = 16*1024; static const int g_lineLimit = 16*1024;
@ -88,12 +88,12 @@ ViewMap KCrashBookmarkImporterImpl::parseCrashLog_noemit( const TQString & filen
return views; return views;
} }
TQStringList KCrashBookmarkImporter::getCrashLogs() TQStringList TDECrashBookmarkImporter::getCrashLogs()
{ {
return KCrashBookmarkImporterImpl::getCrashLogs(); return TDECrashBookmarkImporterImpl::getCrashLogs();
} }
TQStringList KCrashBookmarkImporterImpl::getCrashLogs() TQStringList TDECrashBookmarkImporterImpl::getCrashLogs()
{ {
TQMap<TQString, bool> activeLogs; TQMap<TQString, bool> activeLogs;
@ -127,7 +127,7 @@ TQStringList KCrashBookmarkImporterImpl::getCrashLogs()
activeLogs[ret] = true; activeLogs[ret] = true;
} }
TQDir d( KCrashBookmarkImporterImpl().findDefaultLocation() ); TQDir d( TDECrashBookmarkImporterImpl().findDefaultLocation() );
d.setSorting( TQDir::Time ); d.setSorting( TQDir::Time );
d.setFilter( TQDir::Files ); d.setFilter( TQDir::Files );
d.setNameFilter( "konqueror-crash-*.log" ); d.setNameFilter( "konqueror-crash-*.log" );
@ -154,10 +154,10 @@ TQStringList KCrashBookmarkImporterImpl::getCrashLogs()
return crashFiles; return crashFiles;
} }
void KCrashBookmarkImporterImpl::parse() void TDECrashBookmarkImporterImpl::parse()
{ {
TQDict<bool> signatureMap; TQDict<bool> signatureMap;
TQStringList crashFiles = KCrashBookmarkImporterImpl::getCrashLogs(); TQStringList crashFiles = TDECrashBookmarkImporterImpl::getCrashLogs();
int count = 1; int count = 1;
for ( TQStringList::Iterator it = crashFiles.begin(); it != crashFiles.end(); ++it ) for ( TQStringList::Iterator it = crashFiles.begin(); it != crashFiles.end(); ++it )
{ {
@ -185,29 +185,29 @@ void KCrashBookmarkImporterImpl::parse()
} }
} }
TQString KCrashBookmarkImporter::crashBookmarksDir() TQString TDECrashBookmarkImporter::crashBookmarksDir()
{ {
static KCrashBookmarkImporterImpl *p = 0; static TDECrashBookmarkImporterImpl *p = 0;
if (!p) if (!p)
p = new KCrashBookmarkImporterImpl; p = new TDECrashBookmarkImporterImpl;
return p->findDefaultLocation(); return p->findDefaultLocation();
} }
void KCrashBookmarkImporterImpl::setShouldDelete( bool shouldDelete ) void TDECrashBookmarkImporterImpl::setShouldDelete( bool shouldDelete )
{ {
m_shouldDelete = shouldDelete; m_shouldDelete = shouldDelete;
} }
void KCrashBookmarkImporter::parseCrashBookmarks( bool del ) void TDECrashBookmarkImporter::parseCrashBookmarks( bool del )
{ {
KCrashBookmarkImporterImpl importer; TDECrashBookmarkImporterImpl importer;
importer.setFilename( m_fileName ); importer.setFilename( m_fileName );
importer.setShouldDelete( del ); importer.setShouldDelete( del );
importer.setupSignalForwards( &importer, this ); importer.setupSignalForwards( &importer, this );
importer.parse(); importer.parse();
} }
TQString KCrashBookmarkImporterImpl::findDefaultLocation( bool ) const TQString TDECrashBookmarkImporterImpl::findDefaultLocation( bool ) const
{ {
return locateLocal( "tmp", "" ); return locateLocal( "tmp", "" );
} }

@ -34,12 +34,12 @@
* A class for importing all crash sessions as bookmarks * A class for importing all crash sessions as bookmarks
* @deprecated * @deprecated
*/ */
class TDEIO_EXPORT_DEPRECATED KCrashBookmarkImporter : public TQObject class TDEIO_EXPORT_DEPRECATED TDECrashBookmarkImporter : public TQObject
{ {
Q_OBJECT Q_OBJECT
public: public:
KCrashBookmarkImporter( const TQString & fileName ) : m_fileName(fileName) {} TDECrashBookmarkImporter( const TQString & fileName ) : m_fileName(fileName) {}
~KCrashBookmarkImporter() {} ~TDECrashBookmarkImporter() {}
void parseCrashBookmarks( bool del = true ); void parseCrashBookmarks( bool del = true );
static TQString crashBookmarksDir( ); static TQString crashBookmarksDir( );
static TQStringList getCrashLogs(); // EMPTY! static TQStringList getCrashLogs(); // EMPTY!
@ -57,10 +57,10 @@ protected:
* A class for importing all crash sessions as bookmarks * A class for importing all crash sessions as bookmarks
* @since 3.2 * @since 3.2
*/ */
class TDEIO_EXPORT KCrashBookmarkImporterImpl : public KBookmarkImporterBase class TDEIO_EXPORT TDECrashBookmarkImporterImpl : public KBookmarkImporterBase
{ {
public: public:
KCrashBookmarkImporterImpl() : m_shouldDelete(false) { } TDECrashBookmarkImporterImpl() : m_shouldDelete(false) { }
void setShouldDelete(bool); void setShouldDelete(bool);
virtual void parse(); virtual void parse();
virtual TQString findDefaultLocation(bool forSaving = false) const; virtual TQString findDefaultLocation(bool forSaving = false) const;
@ -68,7 +68,7 @@ public:
private: private:
bool m_shouldDelete; bool m_shouldDelete;
TQMap<TQString, TQString> parseCrashLog_noemit( const TQString & filename, bool del ); TQMap<TQString, TQString> parseCrashLog_noemit( const TQString & filename, bool del );
class KCrashBookmarkImporterImplPrivate *d; class TDECrashBookmarkImporterImplPrivate *d;
}; };
#endif #endif

@ -170,7 +170,7 @@ SlaveBase::SlaveBase( const TQCString &protocol,
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
if (!getenv("TDE_DEBUG")) if (!getenv("TDE_DEBUG"))
{ {
KCrash::setCrashHandler( sigsegv_handler ); TDECrash::setCrashHandler( sigsegv_handler );
signal(SIGILL,&sigsegv_handler); signal(SIGILL,&sigsegv_handler);
signal(SIGTRAP,&sigsegv_handler); signal(SIGTRAP,&sigsegv_handler);
signal(SIGABRT,&sigsegv_handler); signal(SIGABRT,&sigsegv_handler);

Loading…
Cancel
Save