| 98 | GlobalHandler* GlobalHandler::instance_ = 0; |
| 99 | |
| 100 | GlobalHandler::GlobalHandler(const QString& minidumpPath, const QString& reporter) |
| 101 | : m_fullyCreated(false) |
| 102 | { |
| 103 | if(instance_) { |
| 104 | qWarning("BreakpadQt: GlobalHandler already exists!"); |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | // path to crash reporter |
| 109 | if(reporter.isNull()) { |
| 110 | # if defined(Q_OS_MAC) |
| 111 | // TODO what if we are not inside bundle? |
| 112 | reporterFullFileName_ = QDir::cleanPath(qApp->applicationDirPath() + QLatin1String("/../Resources/crashreporter")); |
| 113 | # elif defined(Q_OS_LINUX) |
| 114 | // MAYBE better default place? libexec? or what? |
| 115 | reporterFullFileName_ = qApp->applicationDirPath() + QLatin1String("/crashreporter"); |
| 116 | # elif defined(Q_OS_WIN32) |
| 117 | reporterFullFileName_ = qApp->applicationDirPath() + QLatin1String("/crashreporter.exe"); |
| 118 | # else |
| 119 | What is this?! |
| 120 | # endif |
| 121 | } else { |
| 122 | reporterFullFileName_ = reporter; |
| 123 | if(!QDir::isAbsolutePath(reporterFullFileName_)) { |
| 124 | reporterFullFileName_ = QDir::cleanPath(qApp->applicationDirPath() + QLatin1String("/") + reporter); |
| 125 | } |
| 126 | } |
| 127 | Q_ASSERT(QDir::isAbsolutePath(reporterFullFileName_)); |
| 128 | Q_ASSERT(QDir().exists(reporterFullFileName_)); |
| 129 | |
| 130 | // path to minidumps |
| 131 | Q_ASSERT(QDir::isAbsolutePath(minidumpPath)); |
| 132 | QDir().mkpath(minidumpPath); |
| 133 | Q_ASSERT(QDir().exists(minidumpPath)); |
| 134 | |
| 135 | handler_ = new google_breakpad::ExceptionHandler( |
| 136 | #if defined(Q_OS_MAC) || defined(Q_OS_LINUX) |
| 137 | minidumpPath.toUtf8().data(), |
| 138 | #elif defined(Q_OS_WIN32) |
| 139 | minidumpPath.toStdWString(), |
| 140 | #endif |
| 141 | /*FilterCallback*/ 0, MDCallback, /*context*/ 0, true); |
| 142 | |
| 143 | instance_ = this; |
| 144 | m_fullyCreated = true; |
| 145 | } |
| 146 | |
| 147 | GlobalHandler::~GlobalHandler() |
| 148 | { |
nothing calls this directly
no outgoing calls
no test coverage detected