# HG changeset patch # User unc0rr # Date 1353355812 -14400 # Node ID 66bc20d089fc8848749f85bd47bf3ed65e445c3d # Parent bb767182993545fcaa2d5dc623ce0e074b32c706 Okay, remove previous request only if it has same parent as this one. Fixes the last note of previous commit (which was nearly impossible to hit, but whatever, just cleaning implementation) diff -r bb7671829935 -r 66bc20d089fc QTfrontend/game.cpp --- a/QTfrontend/game.cpp Mon Nov 19 23:43:45 2012 +0400 +++ b/QTfrontend/game.cpp Tue Nov 20 00:10:12 2012 +0400 @@ -37,7 +37,7 @@ QString training, campaign, campaignScript, campaignTeam; // TODO: Cleaner solution? HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg, QString ammo, TeamSelWidget* pTeamSelWidget) : - TCPBase(true), + TCPBase(true, 0), ammostr(ammo), m_pTeamSelWidget(pTeamSelWidget) { diff -r bb7671829935 -r 66bc20d089fc QTfrontend/net/hwmap.cpp --- a/QTfrontend/net/hwmap.cpp Mon Nov 19 23:43:45 2012 +0400 +++ b/QTfrontend/net/hwmap.cpp Tue Nov 20 00:10:12 2012 +0400 @@ -20,8 +20,8 @@ #include "hwconsts.h" #include "hwmap.h" -HWMap::HWMap() : - TCPBase(false) +HWMap::HWMap(QObject * parent) : + TCPBase(false, parent) { } diff -r bb7671829935 -r 66bc20d089fc QTfrontend/net/hwmap.h --- a/QTfrontend/net/hwmap.h Mon Nov 19 23:43:45 2012 +0400 +++ b/QTfrontend/net/hwmap.h Tue Nov 20 00:10:12 2012 +0400 @@ -39,7 +39,7 @@ Q_OBJECT public: - HWMap(); + HWMap(QObject *parent = 0); virtual ~HWMap(); void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData); bool couldBeRemoved(); diff -r bb7671829935 -r 66bc20d089fc QTfrontend/net/tcpBase.cpp --- a/QTfrontend/net/tcpBase.cpp Mon Nov 19 23:43:45 2012 +0400 +++ b/QTfrontend/net/tcpBase.cpp Tue Nov 20 00:10:12 2012 +0400 @@ -38,7 +38,8 @@ IPCSocket->deleteLater(); } -TCPBase::TCPBase(bool demoMode) : +TCPBase::TCPBase(bool demoMode, QObject *parent) : + QObject(parent), m_hasStarted(false), m_isDemoMode(demoMode), IPCSocket(0) @@ -144,9 +145,12 @@ } else { - if(couldCancelPreviousRequest && srvsList.last()->couldBeRemoved()) + TCPBase * last = srvsList.last(); + if(couldCancelPreviousRequest + && last->couldBeRemoved() + && (last->parent() == parent())) { - TCPBase * last = srvsList.takeLast(); + srvsList.removeLast(); last->deleteLater(); Start(couldCancelPreviousRequest); } else diff -r bb7671829935 -r 66bc20d089fc QTfrontend/net/tcpBase.h --- a/QTfrontend/net/tcpBase.h Mon Nov 19 23:43:45 2012 +0400 +++ b/QTfrontend/net/tcpBase.h Tue Nov 20 00:10:12 2012 +0400 @@ -38,7 +38,7 @@ Q_OBJECT public: - TCPBase(bool demoMode); + TCPBase(bool demoMode, QObject * parent = 0); virtual ~TCPBase(); virtual bool couldBeRemoved(); diff -r bb7671829935 -r 66bc20d089fc QTfrontend/ui/widget/mapContainer.cpp --- a/QTfrontend/ui/widget/mapContainer.cpp Mon Nov 19 23:43:45 2012 +0400 +++ b/QTfrontend/ui/widget/mapContainer.cpp Tue Nov 20 00:10:12 2012 +0400 @@ -298,7 +298,7 @@ void HWMapContainer::askForGeneratedPreview() { - pMap = new HWMap(); + pMap = new HWMap(this); connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int))); connect(pMap, SIGNAL(destroyed(QObject *)), this, SLOT(onPreviewMapDestroyed(QObject *)));