--- a/QTfrontend/net/tcpBase.cpp Sun Jun 15 00:02:25 2014 +0200
+++ b/QTfrontend/net/tcpBase.cpp Sun Jun 15 04:33:54 2014 +0200
@@ -172,7 +172,10 @@
thread->start();
#else
process = new QProcess(this);
- connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
+ connect(process, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(StartProcessError(QProcess::ProcessError)));
+ connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(onEngineDeath(int, QProcess::ExitStatus)));
QStringList arguments = getArguments();
#ifdef QT_DEBUG
@@ -198,7 +201,9 @@
#endif
emit isReadyNow();
}
+
IPCSocket->deleteLater();
+ IPCSocket = NULL;
deleteLater();
}
@@ -217,6 +222,37 @@
ClientDisconnect();
}
+void TCPBase::onEngineDeath(int exitCode, QProcess::ExitStatus exitStatus)
+{
+ Q_UNUSED(exitStatus);
+
+ ClientDisconnect();
+
+ // show error message if there was an error that was not an engine's
+ // fatal error - because that one already sent a info via IPC
+ if ((exitCode != 0) && (exitCode != 2))
+ {
+ // inform user that something bad happened
+ MessageDialog::ShowFatalMessage(
+ tr("The game engine died unexpectedly!")
+ + QString("\n(exit code %1)").arg(exitCode)
+ + "\n\n " + tr("We are very sorry for the inconvenience :(") + "\n\n" +
+ tr("If this keeps happening, please click the '%1' button in the main menu!")
+ .arg("Feedback"));
+
+ }
+
+ // cleanup up
+ if (IPCSocket)
+ {
+ IPCSocket->close();
+ IPCSocket->deleteLater();
+ }
+
+ // plot suicide
+ deleteLater();
+}
+
void TCPBase::tcpServerReady()
{
disconnect(srvsList.first(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));