MCPcopy Create free account
hub / github.com/buzzySmile/qBreakpad / GlobalHandler

Method GlobalHandler

handler/BreakpadHandler.cpp:100–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98GlobalHandler* GlobalHandler::instance_ = 0;
99
100GlobalHandler::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
147GlobalHandler::~GlobalHandler()
148{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected