Delete poller when game is over flibqtfrontend
authorunc0rr
Fri, 14 Dec 2012 00:12:00 +0400
branchflibqtfrontend
changeset 8280 734b069a418e
parent 8278 9cdfcb5b7ddd
child 8282 1f81bcce3ee6
Delete poller when game is over
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/hwform.cpp
--- a/QTfrontend/game.cpp	Sat Dec 08 22:53:23 2012 +0400
+++ b/QTfrontend/game.cpp	Fri Dec 14 00:12:00 2012 +0400
@@ -39,7 +39,8 @@
     TCPBase(0)
     , ammostr(ammo)
     , m_pTeamSelWidget(pTeamSelWidget)
-    , m_conn(NULL)
+    , m_conn(0)
+    , m_poller(0)
 {
     this->config = config;
     this->gamecfg = gamecfg;
@@ -462,7 +463,10 @@
                 else
                     emit HaveRecord(rtNeither, demo);
         }*/
+
      game->SetGameState(gsStopped);
+
+     delete game->m_poller;
 }
 
 void HWGame::onEngineMessage(void *context, const uint8_t *em, size_t size)
@@ -489,5 +493,5 @@
     flib_gameconn_onErrorMessage(m_conn, onErrorMessage, this);
     flib_gameconn_onGameRecorded(m_conn, onGameRecorded, this);
 
-    new FrontLibPoller((void (*)(void *))flib_gameconn_tick, m_conn, this);
+    m_poller = new FrontLibPoller((void (*)(void *))flib_gameconn_tick, m_conn, this);
 }
--- a/QTfrontend/game.h	Sat Dec 08 22:53:23 2012 +0400
+++ b/QTfrontend/game.h	Fri Dec 14 00:12:00 2012 +0400
@@ -48,7 +48,7 @@
     rtNeither,
 };
 
-bool checkForDir(const QString & dir);
+class FrontLibPoller;
 
 class HWGame : public TCPBase
 {
@@ -105,6 +105,7 @@
         GameType gameType;
 
         flib_gameconn * m_conn;
+        FrontLibPoller * m_poller;
 
         void commonConfig();
         void SendConfig();
--- a/QTfrontend/hwform.cpp	Sat Dec 08 22:53:23 2012 +0400
+++ b/QTfrontend/hwform.cpp	Fri Dec 14 00:12:00 2012 +0400
@@ -112,6 +112,8 @@
 
 GameUIConfig* HWForm::config = NULL;
 
+bool checkForDir(const QString & dir);
+
 HWForm::HWForm(QWidget *parent, QString styleSheet)
     : QMainWindow(parent)
     , game(0)