QTfrontend/hwform.cpp
changeset 6190 1db2486e45f4
parent 6180 0992fc5a4ad9
child 6205 7764cbe4ddd7
--- a/QTfrontend/hwform.cpp	Sun Oct 23 01:47:44 2011 -0400
+++ b/QTfrontend/hwform.cpp	Sun Oct 23 09:01:53 2011 +0200
@@ -455,6 +455,10 @@
 
 void HWForm::OnPageShown(quint8 id, quint8 lastid)
 {
+    // with all those signals firing around make sure we don't switch a page
+    // at the same time in different threads
+    onPageShownMutex.lock();
+
 #ifdef USE_XFIRE
     updateXfire();
 #endif
@@ -479,6 +483,13 @@
             ui.pageNetGame->pGameCFG->pMapContainer->mapDrawingFinished();
     }
 
+    if (id == ID_PAGE_ROOMSLIST) {
+        if (hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
+            game->netSuspend = true;
+            game->KillAllTeams();
+        }
+    }
+
     if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
         QStringList tmNames = config->GetTeamsList();
         TeamSelWidget* curTeamSelWidget;
@@ -525,13 +536,11 @@
     if (id == ID_PAGE_NETGAME) // joining a room
         ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text());
 // joining the lobby 
-    else if (id == ID_PAGE_ROOMSLIST) {
-        if (hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
-            game->netSuspend = true;
-            game->KillAllTeams();
-        }
+    else if (id == ID_PAGE_ROOMSLIST)
         ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
-    }
+
+
+    onPageShownMutex.unlock();
 }
 
 void HWForm::GoToPage(int id)