diff --git a/ZoomPipeline_FuncSvr/zpmainframe.cpp b/ZoomPipeline_FuncSvr/zpmainframe.cpp index c839dfa4fc1ff0d7cc27c826f16b3e2f9898e1ac..ce9d51ea20a4a790b81772e9bce2a53f5ad9fdf9 100644 --- a/ZoomPipeline_FuncSvr/zpmainframe.cpp +++ b/ZoomPipeline_FuncSvr/zpmainframe.cpp @@ -123,7 +123,8 @@ void ZPMainFrame::changeEvent(QEvent *e) if (this->isMinimized()==true) { this->hide(); - this->m_IconTray->showMessage(tr("Server still running"), + if (m_IconTray) + this->m_IconTray->showMessage(tr("Server still running"), tr("If you want to terminate server, just using exit Toolbar button.")); } break; @@ -384,12 +385,15 @@ void ZPMainFrame::timerEvent(QTimerEvent * e) static int ppIc = 0; lastRecieved = g_bytesRecieved; lastSent = g_bytesSent; - if (++ppIc % 2==0) - m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic Green.png")); - else - m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic, Performa 250, 275.png")); + if (m_IconTray) + { + if (++ppIc % 2==0) + m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic Green.png")); + else + m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic, Performa 250, 275.png")); + } } - else + else if (m_IconTray) { m_IconTray->setIcon(QIcon(":/icons/Resources/Color Classic.png")); } @@ -974,21 +978,27 @@ void ZPMainFrame::closeEvent(QCloseEvent * e) if (this->isVisible()==true) { this->hide(); - this->m_IconTray->showMessage(tr("Server still running"), + if (m_IconTray) + this->m_IconTray->showMessage(tr("Server still running"), tr("If you want to terminate server, just using exit Toolbar button.")); e->ignore(); } else { - e->accept(); - this->m_IconTray->showMessage(tr("Server is going to closed"), + if (m_IconTray) + this->m_IconTray->showMessage(tr("Server is going to closed"), tr("Waiting for all unfinished progress...")); + e->accept(); + m_IconTray->deleteLater(); + m_IconTray = nullptr; } } void ZPMainFrame::on_actionExit_triggered() { this->hide(); - this->m_IconTray->setContextMenu(0); + if (m_IconTray) + this->m_IconTray->setContextMenu(0); this->close(); + }