QTfrontend/netwwwserver.cpp
changeset 659 5eafb20566f1
parent 635 0fb6d55ecd66
child 660 7c155e849602
--- a/QTfrontend/netwwwserver.cpp	Fri Dec 14 15:02:46 2007 +0000
+++ b/QTfrontend/netwwwserver.cpp	Fri Dec 14 15:36:00 2007 +0000
@@ -26,6 +26,9 @@
 HWNetWwwServer::HWNetWwwServer(QObject *parent, const QString & descr, quint16 port) :
   HWNetRegisterServer(parent, descr, port), timer(0)
 {
+	destroyPosted = false;
+	destroyPostId = 0;
+
 	http = new QHttp(this);
 	http->setHost("www.hedgewars.org", 80);
 	connect(http, SIGNAL(requestFinished(int, bool)), this, SLOT(onClientRead(int, bool)));
@@ -40,6 +43,12 @@
 
 void HWNetWwwServer::onClientRead(int id, bool error)
 {
+	if (destroyPosted && (id == destroyPostId))
+	{
+		deleteLater();
+		return;
+	}
+
 	if (error)
 	{
 		QMessageBox::critical(0,
@@ -80,5 +89,6 @@
 	QString request = QString("id=%1&key=%2")
 			.arg(servid)
 			.arg(servkey);
-	http->post("/games/destroy_game", request.toUtf8());
+	destroyPostId = http->post("/games/destroy_game", request.toUtf8());
+	destroyPosted = true;
 }