/*! * @brief Gets crash-reporter-daemon pid and saves it to file. * * @param app Reference to application. * @return True, if first startup; otherwise false. */ bool getPid(QCoreApplication &app) { QFile pidFile(CREPORTER_PID_FILE); qint64 pid = 0; bool firstStartup = true; // Get new PID. pid = app.applicationPid(); qDebug() << __PRETTY_FUNCTION__ << CReporter::DaemonBinaryName << "[" << pid << "] starting..."; if (pidFile.exists()) { firstStartup = false; qDebug() << __PRETTY_FUNCTION__ << "Removing stale PID file."; pidFile.remove(); } if (pidFile.open(QIODevice::WriteOnly)) { QTextStream out(&pidFile); out << pid; pidFile.close(); } qDebug() << __PRETTY_FUNCTION__ << "Startup delayed =" << firstStartup; return firstStartup; }
void Soprano::Error::ErrorCache::setError( const Error& error ) const { if ( error ) { QCoreApplication* app = QCoreApplication::instance(); qDebug() << ( app ? QString( "%1(%2)" ).arg( app->applicationFilePath() ).arg( app->applicationPid() ) : QString() ) << "Soprano:" << error; QMutexLocker locker( &d->errorMapMutex ); d->errorMap[QThread::currentThread()] = error; } else { clearError(); } }