Commit aaca1bcc authored by Dorian Zedler's avatar Dorian Zedler

- fixed some errors which occurred when calling qApp->exit()

parent a4dd7063
......@@ -11,15 +11,15 @@ int main(int argc, char *argv[])
QCoreApplication a(argc, argv);
qDebug() << "---------------------------------------------";
qDebug() << "Speed Climbing Stopwatch Basestation - V" << APP_VERSION << "";
qDebug() << "---------------------------------------------";
qDebug() << "--------------------------------------------------" ;
qDebug() << "- Speed Climbing Stopwatch Basestation - V" << APP_VERSION << "-";
qDebug() << "--------------------------------------------------";
//construct MainActivity class
MainActivity * pMainActivity = new MainActivity;
currentExitCode = a.exec();
delete pMainActivity;
pMainActivity->deleteLater();
qDebug() << "end: " << currentExitCode << "\n---------------------------------------------\n";
}
......@@ -27,10 +27,7 @@ int main(int argc, char *argv[])
// a reboot of the host was requested
QProcess rebootProcess;
rebootProcess.start("sudo reboot now");
QEventLoop rebootWaitLoop;
QObject::connect(&rebootProcess, SIGNAL(finished), &rebootWaitLoop, SLOT(quit));
rebootWaitLoop.exec();
rebootProcess.waitForFinished();
}
return currentExitCode;
......
......@@ -92,19 +92,25 @@ MainActivity::MainActivity(QObject *parent) : QObject(parent)
MainActivity::~MainActivity(){
// destructor
delete this->appSettings;
this->appSettings->deleteLater();
delete this->date;
this->athleteProfiles->deleteLater();
this->commandPlayer->deleteLater();
this->falseSoundPlayer->deleteLater();
this->startSoundPlayer->deleteLater();
for(int i = 0; i < this->speedTimers.length(); i++){
delete this->speedTimers[i];
this->speedTimers[i]->deleteLater();
}
for(int i=0; i < this->extensionConnections.length(); i++){
delete this->extensionConnections[i];
this->extensionConnections[i]->deleteLater();
}
delete this->socketServer;
this->socketServer->deleteLater();
delete this->nextActionTimer;
this->nextActionTimer->deleteLater();
#ifdef RASPI
digitalWrite(this->leds["RED"],0);
......@@ -438,7 +444,6 @@ void MainActivity::handleSocketCommand(SocketServer::socketClient *socketClient,
socketClient->updateSubscriptions = requestData["updateSubs"].toVariant().toStringList();
socketClient->usingTerminationKeys = requestData["usingTerminationKeys"].toBool();
qDebug() << "set update subs to: " << socketClient->updateSubscriptions;
replyHeader = 200;
replyData = QJsonObject::fromVariantMap({ { "version", APP_VERSION }, { "time", this->date->currentMSecsSinceEpoch() } });
......@@ -774,6 +779,9 @@ void MainActivity::handleSocketCommand(SocketServer::socketClient *socketClient,
// send the reply back to the client
this->socketServer->sendToClient(socket, jsonReply.toJson());
// wait for the client to recieve the reply
socket->waitForBytesWritten();
// perform the actual update
QString newFirmwareString = signedMessage.split("<BIN>")[1].split("</BIN>")[0];
//qDebug() << newFirmwareString;
......
......@@ -20,10 +20,10 @@ SocketServer::SocketServer() : QObject()
SocketServer::~SocketServer(){
for(int i=0; i<this->clients.length(); i++){
this->clients[i].socket->close();
delete this->clients[i].socket;
this->clients[i].socket->deleteLater();
}
delete this->tcpServer;
this->tcpServer->deleteLater();
}
// -----------------------
......
......@@ -31,6 +31,7 @@ SpeedTimer::SpeedTimer(ExtensionConn *topPad, ExtensionConn *startPad, bool auto
SpeedTimer::~SpeedTimer(){
delete this->date;
this->clickSoundPlayer->deleteLater();
}
// --------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment