Skip to content
Permalink
Browse files

Log overlay helper process errors in OverlayPrivateWin.

OverlayPrivateWin used to only listen for process
termination. Technically, this should work just fine.

This change makes OverlayPrivateWin listen for process
errors as well, by subscribing to the error() signal
of the QProcess of each of our helpers.

The idea is that this could provide us helpful error
messages when troubleshooting issues where overlay
helpers are exiting untimely.
  • Loading branch information...
mkrautz committed Feb 20, 2015
1 parent 3018c5e commit 8e31de788f88db76f5d0c889481ab6661c53fa75
Showing with 39 additions and 0 deletions.
  1. +38 −0 src/mumble/Overlay_win.cpp
  2. +1 −0 src/mumble/Overlay_win.h
@@ -73,6 +73,7 @@ static bool canRun64BitPrograms() {

OverlayPrivateWin::OverlayPrivateWin(QObject *p) : OverlayPrivate(p) {
m_allow64bit = canRun64BitPrograms();
m_active = false;

m_helper_exe_path = QString::fromLatin1("%1/mumble_ol.exe").arg(qApp->applicationDirPath());
m_helper_exe_args = QStringList(QString::number(OVERLAY_MAGIC_NUMBER));
@@ -81,6 +82,9 @@ OverlayPrivateWin::OverlayPrivateWin(QObject *p) : OverlayPrivate(p) {
connect(m_helper_process, SIGNAL(started()),
this, SLOT(onHelperProcessStarted()));

connect(m_helper_process, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(onHelperProcessError(QProcess::ProcessError)));

connect(m_helper_process, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(onHelperProcessExited(int, QProcess::ExitStatus)));

@@ -91,6 +95,9 @@ OverlayPrivateWin::OverlayPrivateWin(QObject *p) : OverlayPrivate(p) {
connect(m_helper64_process, SIGNAL(started()),
this, SLOT(onHelperProcessStarted()));

connect(m_helper64_process, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(onHelperProcessError(QProcess::ProcessError)));

connect(m_helper64_process, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(onHelperProcessExited(int, QProcess::ExitStatus)));
}
@@ -140,6 +147,23 @@ static const char *exitStatusString(QProcess::ExitStatus exitStatus) {
return "unknown";
}

static const char *processErrorString(QProcess::ProcessError processError) {
switch (processError) {
case QProcess::FailedToStart:
return "process failed to start";
case QProcess::Crashed:
return "process crashed";
case QProcess::Timedout:
return "process wait operation timed out";
case QProcess::WriteError:
return "an error occurred when attempting to write to the process";
case QProcess::ReadError:
return "an error occurred when attempting to read from the process";
}

return "unknown";
}

void OverlayPrivateWin::onHelperProcessStarted() {
QProcess *helper = qobject_cast<QProcess *>(sender());
QString path;
@@ -154,6 +178,20 @@ void OverlayPrivateWin::onHelperProcessStarted() {
qPrintable(path), static_cast<unsigned long long>(pi->dwProcessId));
}

void OverlayPrivateWin::onHelperProcessError(QProcess::ProcessError processError) {
QProcess *helper = qobject_cast<QProcess *>(sender());
QString path;
if (helper == m_helper_process) {
path = m_helper_exe_path;
} else if (helper == m_helper64_process) {
path = m_helper64_exe_path;
}

qWarning("OverlayPrivateWin: an error occured for overlay helper process '%s': %s",
qPrintable(path),
processErrorString(processError));
}

void OverlayPrivateWin::onHelperProcessExited(int exitCode, QProcess::ExitStatus exitStatus) {
QProcess *helper = qobject_cast<QProcess *>(sender());
QString path;
@@ -50,6 +50,7 @@ class OverlayPrivateWin : public OverlayPrivate {

public slots:
void onHelperProcessStarted();
void onHelperProcessError(QProcess::ProcessError);
void onHelperProcessExited(int exitCode, QProcess::ExitStatus exitStatus);

protected:

0 comments on commit 8e31de7

Please sign in to comment.
You can’t perform that action at this time.