* fixed some threading problems (1 possible crash: SceneCharSelection window resized or reloaded while WorldSession is destroyed)

This commit is contained in:
false_genesis 2008-08-30 12:18:49 +00:00
parent 29f133c1e7
commit aa0450df9e
5 changed files with 8 additions and 3 deletions

View File

@ -64,6 +64,7 @@ protected:
SceneState _scenestate;
uint32 scenedata[SCENEDATA_SIZE]; // generic storage for anything the PseuInstance thread wants to tell us
SCPDatabase *textdb;
ZThread::FastMutex mutex;
};
class SceneGuiStart : public Scene
@ -148,7 +149,6 @@ private:
ShTlTerrainSceneNode *terrain;
MCameraFPS *camera;
MyEventReceiver *eventrecv;
ZThread::FastMutex mutex;
uint32 map_gridX, map_gridY;
WorldSession *wsession;
World *world;

View File

@ -162,6 +162,7 @@ void SceneCharSelection::OnResize(void)
GetStringFromDB(ISCENE_CHARSEL_BUTTONS, DSCENE_CHARSEL_BUTTON_DELCHAR).c_str());
realmwin = NULL;
mutex.acquire();
if(scenedata[ISCENE_CHARSEL_REALMFIRST])
{
dimension2d<s32> dim;
@ -260,6 +261,7 @@ void SceneCharSelection::OnResize(void)
}
}
mutex.release();
}

View File

@ -701,7 +701,7 @@ void WorldSession::EnterWorldWithCharacter(std::string name)
WorldPacket pkt(CMSG_PLAYER_LOGIN,8);
pkt << _myGUID;
SendWorldPacket(pkt);
AddSendWorldPacket(pkt); // it can be called from gui thread also, use threadsafe version
// close realm session when logging into world
if(!MustDie() && _socket->IsOk() && GetInstance()->GetRSession())

View File

@ -127,5 +127,6 @@ void WorldSocket::InitCrypt(BigNumber *k)
{
_crypt.SetKey(k);
_crypt.Init();
logdebug("WorldSocket: Crypt initialized");
std::string tmp = toHexDump(_crypt.GetKey(),_crypt.GetKeySize(), false);
logdebug("WorldSocket: Crypt initialized [%s]",tmp.c_str());
}

View File

@ -36,6 +36,8 @@ class AuthCrypt
void Init();
void SetKey(BigNumber *);
inline uint8 *GetKey(void) { return &_key[0]; }
inline uint32 GetKeySize(void) { return _key.size(); }
void DecryptRecv(uint8 *, size_t);
void EncryptSend(uint8 *, size_t);