mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 14:11:15 +02:00
- bugfixes for processing disconnect and game end scenarios. These fixes corrected a bunch of segfaults when client or server disconnect.
This commit is contained in:
@@ -712,8 +712,7 @@ void Game::mouseDownLeft(int x, int y){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(errorMessageBox.getEnabled() == true) {
|
if(errorMessageBox.getEnabled() == true) {
|
||||||
int button= 1;
|
if(errorMessageBox.mouseClick(x, y)) {
|
||||||
if(errorMessageBox.mouseClick(x, y, button)) {
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
//close message box
|
//close message box
|
||||||
errorMessageBox.setEnabled(false);
|
errorMessageBox.setEnabled(false);
|
||||||
|
@@ -741,10 +741,12 @@ void ClientInterface::waitForMessage()
|
|||||||
int waitLoopCount = 0;
|
int waitLoopCount = 0;
|
||||||
while(getNextMessageType(true) == nmtInvalid) {
|
while(getNextMessageType(true) == nmtInvalid) {
|
||||||
if(isConnected() == false) {
|
if(isConnected() == false) {
|
||||||
|
if(quit == false) {
|
||||||
//throw runtime_error("Disconnected");
|
//throw runtime_error("Disconnected");
|
||||||
//sendTextMessage("Server has Disconnected.",-1);
|
//sendTextMessage("Server has Disconnected.",-1);
|
||||||
DisplayErrorMessage("Server has Disconnected.");
|
DisplayErrorMessage("Server has Disconnected.");
|
||||||
quit= true;
|
quit= true;
|
||||||
|
}
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -535,7 +535,8 @@ void ServerInterface::update() {
|
|||||||
connectionSlot->getChatTextList().empty() == false) {
|
connectionSlot->getChatTextList().empty() == false) {
|
||||||
try {
|
try {
|
||||||
for(int chatIdx = 0; chatIdx < connectionSlot->getChatTextList().size(); chatIdx++) {
|
for(int chatIdx = 0; chatIdx < connectionSlot->getChatTextList().size(); chatIdx++) {
|
||||||
const ChatMsgInfo &msg = connectionSlot->getChatTextList()[chatIdx];
|
ChatMsgInfo msg(connectionSlot->getChatTextList()[chatIdx]);
|
||||||
|
this->addChatInfo(msg);
|
||||||
|
|
||||||
string newChatText = msg.chatText.c_str();
|
string newChatText = msg.chatText.c_str();
|
||||||
string newChatSender = msg.chatSender.c_str();
|
string newChatSender = msg.chatSender.c_str();
|
||||||
@@ -547,19 +548,13 @@ void ServerInterface::update() {
|
|||||||
broadcastMessage(&networkMessageText, connectionSlot->getPlayerIndex());
|
broadcastMessage(&networkMessageText, connectionSlot->getPlayerIndex());
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
|
||||||
|
|
||||||
//chatText = newChatText.c_str();
|
|
||||||
//chatSender = newChatSender.c_str();
|
|
||||||
//chatTeamIndex = newChatTeamIndex;
|
|
||||||
this->addChatInfo(msg);
|
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after connectionSlot->clearChatInfo chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,chatText.c_str(),chatSender.c_str(),chatTeamIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] i = %d\n",__FILE__,__FUNCTION__,__LINE__,i);
|
||||||
// Its possible that the slot is disconnected here
|
// Its possible that the slot is disconnected here
|
||||||
// so check the original pointer again
|
// so check the original pointer again
|
||||||
if(slots[i] != NULL) {
|
if(slots[i] != NULL) {
|
||||||
connectionSlot->clearChatInfo();
|
slots[i]->clearChatInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
|
Reference in New Issue
Block a user