mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Really fixed the evil bug.
This commit is contained in:
parent
8868105fac
commit
f28c76984c
@ -34,7 +34,10 @@ void CClient::init()
|
||||
serv = NULL;
|
||||
gs = NULL;
|
||||
cb = NULL;
|
||||
shared = new SharedMem();
|
||||
try
|
||||
{
|
||||
shared = new SharedMem();
|
||||
} HANDLE_EXCEPTION
|
||||
}
|
||||
|
||||
CClient::CClient(void)
|
||||
|
@ -26,18 +26,19 @@ struct ServerReady
|
||||
struct SharedMem
|
||||
{
|
||||
boost::interprocess::shared_memory_object smo;
|
||||
boost::interprocess::mapped_region mr;
|
||||
boost::interprocess::mapped_region *mr;
|
||||
ServerReady *sr;
|
||||
|
||||
SharedMem()
|
||||
:smo(boost::interprocess::open_or_create,"vcmi_memory",boost::interprocess::read_write),
|
||||
mr(smo,boost::interprocess::read_write)
|
||||
:smo(boost::interprocess::open_or_create,"vcmi_memory",boost::interprocess::read_write)
|
||||
{
|
||||
smo.truncate(sizeof(ServerReady));
|
||||
sr = new(mr.get_address())ServerReady();
|
||||
mr = new boost::interprocess::mapped_region(smo,boost::interprocess::read_write);
|
||||
sr = new(mr->get_address())ServerReady();
|
||||
};
|
||||
~SharedMem()
|
||||
{
|
||||
delete mr;
|
||||
boost::interprocess::shared_memory_object::remove("vcmi_memory");
|
||||
}
|
||||
};
|
@ -109,6 +109,7 @@ void CVCMIServer::start()
|
||||
try
|
||||
{
|
||||
intpr::shared_memory_object smo(intpr::open_only,"vcmi_memory",intpr::read_write);
|
||||
smo.truncate(sizeof(ServerReady));
|
||||
mr = new intpr::mapped_region(smo,intpr::read_write);
|
||||
sr = (ServerReady*)mr->get_address();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user