Fix crash on server shutdown; fix #1105
This commit is contained in:
parent
d1b243481b
commit
323537d08d
2 changed files with 7 additions and 11 deletions
|
@ -86,13 +86,11 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even
|
||||||
|
|
||||||
void MainWindow::processServerShutdownEvent(const Event_ServerShutdown &event)
|
void MainWindow::processServerShutdownEvent(const Event_ServerShutdown &event)
|
||||||
{
|
{
|
||||||
if (serverShutdownMessageBox)
|
serverShutdownMessageBox.setInformativeText(tr("The server is going to be restarted in %n minute(s).\nAll running games will be lost.\nReason for shutdown: %1", "", event.minutes()).arg(QString::fromStdString(event.reason())));
|
||||||
serverShutdownMessageBox->close();
|
serverShutdownMessageBox.setIconPixmap(QPixmap(":/resources/appicon.svg").scaled(64, 64));
|
||||||
serverShutdownMessageBox = new QMessageBox(this);
|
serverShutdownMessageBox.setText(tr("Scheduled server shutdown"));
|
||||||
serverShutdownMessageBox->setAttribute(Qt::WA_DeleteOnClose);
|
serverShutdownMessageBox.setWindowModality(Qt::ApplicationModal);
|
||||||
serverShutdownMessageBox->setInformativeText(tr("The server is going to be restarted in %n minute(s).\nAll running games will be lost.\nReason for shutdown: %1", "", event.minutes()).arg(QString::fromStdString(event.reason())));
|
serverShutdownMessageBox.setVisible(true);
|
||||||
serverShutdownMessageBox->setText(tr("Scheduled server shutdown"));
|
|
||||||
serverShutdownMessageBox->exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::statusChanged(ClientStatus _status)
|
void MainWindow::statusChanged(ClientStatus _status)
|
||||||
|
@ -436,8 +434,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
createTrayActions();
|
createTrayActions();
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
serverShutdownMessageBox = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QMessageBox>
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
#include "pb/response.pb.h"
|
#include "pb/response.pb.h"
|
||||||
|
|
||||||
|
@ -32,7 +33,6 @@ class LocalClient;
|
||||||
class LocalServer;
|
class LocalServer;
|
||||||
class ServerInfo_User;
|
class ServerInfo_User;
|
||||||
class QThread;
|
class QThread;
|
||||||
class QMessageBox;
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -95,7 +95,7 @@ private:
|
||||||
LocalServer *localServer;
|
LocalServer *localServer;
|
||||||
bool bHasActivated;
|
bool bHasActivated;
|
||||||
|
|
||||||
QMessageBox *serverShutdownMessageBox;
|
QMessageBox serverShutdownMessageBox;
|
||||||
QProcess * cardUpdateProcess;
|
QProcess * cardUpdateProcess;
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = 0);
|
||||||
|
|
Loading…
Reference in a new issue