changed mutex lock
This commit is contained in:
parent
e978624e3f
commit
d0b8c6ebd9
2 changed files with 4 additions and 4 deletions
|
@ -24,11 +24,12 @@ Server_ProtocolHandler::~Server_ProtocolHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is essentially the destructor, but it needs to be called from the
|
// This is essentially the destructor, but it needs to be called from the
|
||||||
// child's destructor with the server mutex locked. Otherwise, the mutex
|
// child's destructor so that the server mutex does not get unlocked during
|
||||||
// could get unlocked while the object is not finished being destroyed,
|
// finalization.
|
||||||
// leading to calls to pure virtual functions.
|
|
||||||
void Server_ProtocolHandler::prepareDestroy()
|
void Server_ProtocolHandler::prepareDestroy()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&server->serverMutex);
|
||||||
|
|
||||||
server->removeClient(this);
|
server->removeClient(this);
|
||||||
|
|
||||||
QMapIterator<int, Server_Room *> roomIterator(rooms);
|
QMapIterator<int, Server_Room *> roomIterator(rooms);
|
||||||
|
|
|
@ -60,7 +60,6 @@ ServerSocketInterface::ServerSocketInterface(Servatrice *_server, QTcpSocket *_s
|
||||||
|
|
||||||
ServerSocketInterface::~ServerSocketInterface()
|
ServerSocketInterface::~ServerSocketInterface()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&servatrice->serverMutex);
|
|
||||||
logger->logMessage("ServerSocketInterface destructor");
|
logger->logMessage("ServerSocketInterface destructor");
|
||||||
|
|
||||||
prepareDestroy();
|
prepareDestroy();
|
||||||
|
|
Loading…
Reference in a new issue