potential fix for
issue #217 (SigSegV while in game room in KillAllTeams - team list change?)
--- 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)
--- a/QTfrontend/hwform.h Sun Oct 23 01:47:44 2011 -0400
+++ b/QTfrontend/hwform.h Sun Oct 23 09:01:53 2011 +0200
@@ -20,6 +20,7 @@
#define HWFORM_H
#include <QMainWindow>
+#include <QMutex>
#include <QStack>
#include <QTime>
@@ -168,12 +169,13 @@
BGWidget * wBackground;
QSignalMapper * pageSwitchMapper;
QByteArray m_lastDemo;
+ QMutex onPageShownMutex;
#ifdef __APPLE__
InstallController * panel;
#endif
- void OnPageShown(quint8 id, quint8 lastid=0);
+ void OnPageShown(quint8 id, quint8 lastid=0); // thread-safe
};
#endif