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)
|
||||
{
|
||||
if (serverShutdownMessageBox)
|
||||
serverShutdownMessageBox->close();
|
||||
serverShutdownMessageBox = new QMessageBox(this);
|
||||
serverShutdownMessageBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
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->setText(tr("Scheduled server shutdown"));
|
||||
serverShutdownMessageBox->exec();
|
||||
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.setIconPixmap(QPixmap(":/resources/appicon.svg").scaled(64, 64));
|
||||
serverShutdownMessageBox.setText(tr("Scheduled server shutdown"));
|
||||
serverShutdownMessageBox.setWindowModality(Qt::ApplicationModal);
|
||||
serverShutdownMessageBox.setVisible(true);
|
||||
}
|
||||
|
||||
void MainWindow::statusChanged(ClientStatus _status)
|
||||
|
@ -436,8 +434,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
createTrayActions();
|
||||
createTrayIcon();
|
||||
}
|
||||
|
||||
serverShutdownMessageBox = 0;
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include "abstractclient.h"
|
||||
#include "pb/response.pb.h"
|
||||
|
||||
|
@ -32,7 +33,6 @@ class LocalClient;
|
|||
class LocalServer;
|
||||
class ServerInfo_User;
|
||||
class QThread;
|
||||
class QMessageBox;
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
@ -95,7 +95,7 @@ private:
|
|||
LocalServer *localServer;
|
||||
bool bHasActivated;
|
||||
|
||||
QMessageBox *serverShutdownMessageBox;
|
||||
QMessageBox serverShutdownMessageBox;
|
||||
QProcess * cardUpdateProcess;
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
|
|
Loading…
Reference in a new issue