mirror of https://github.com/Icinga/icinga2.git
Windows: Fixed crash in Object::~Object().
This commit is contained in:
parent
2c58ec5272
commit
607915c49a
|
@ -27,8 +27,8 @@ using namespace icinga;
|
||||||
Object::Object(void)
|
Object::Object(void)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
boost::mutex::scoped_lock lock(GetMutex());
|
boost::mutex::scoped_lock lock(*GetMutex());
|
||||||
GetAliveObjects().insert(this);
|
GetAliveObjects()->insert(this);
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ Object::Object(void)
|
||||||
Object::~Object(void)
|
Object::~Object(void)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
boost::mutex::scoped_lock lock(GetMutex());
|
boost::mutex::scoped_lock lock(*GetMutex());
|
||||||
GetAliveObjects().erase(this);
|
GetAliveObjects()->erase(this);
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ Object::~Object(void)
|
||||||
*/
|
*/
|
||||||
void Object::Hold(void)
|
void Object::Hold(void)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetMutex());
|
boost::mutex::scoped_lock lock(*GetMutex());
|
||||||
GetHeldObjects().push_back(GetSelf());
|
GetHeldObjects().push_back(GetSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void Object::Hold(void)
|
||||||
*/
|
*/
|
||||||
void Object::ClearHeldObjects(void)
|
void Object::ClearHeldObjects(void)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetMutex());
|
boost::mutex::scoped_lock lock(*GetMutex());
|
||||||
GetHeldObjects().clear();
|
GetHeldObjects().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ Object::SharedPtrHolder Object::GetSelf(void)
|
||||||
*/
|
*/
|
||||||
int Object::GetAliveObjectsCount(void)
|
int Object::GetAliveObjectsCount(void)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetMutex());
|
boost::mutex::scoped_lock lock(*GetMutex());
|
||||||
return GetAliveObjects().size();
|
return GetAliveObjects()->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,9 +95,9 @@ void Object::PrintMemoryProfile(void)
|
||||||
ofstream dictfp("dictionaries.dump.tmp");
|
ofstream dictfp("dictionaries.dump.tmp");
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetMutex());
|
boost::mutex::scoped_lock lock(*GetMutex());
|
||||||
set<Object *>::iterator it;
|
set<Object *>::iterator it;
|
||||||
BOOST_FOREACH(Object *obj, GetAliveObjects()) {
|
BOOST_FOREACH(Object *obj, *GetAliveObjects()) {
|
||||||
pair<map<String, int>::iterator, bool> tt;
|
pair<map<String, int>::iterator, bool> tt;
|
||||||
tt = types.insert(make_pair(Utility::GetTypeName(typeid(*obj)), 1));
|
tt = types.insert(make_pair(Utility::GetTypeName(typeid(*obj)), 1));
|
||||||
if (!tt.second)
|
if (!tt.second)
|
||||||
|
@ -130,9 +130,9 @@ void Object::PrintMemoryProfile(void)
|
||||||
*
|
*
|
||||||
* @returns currently active objects
|
* @returns currently active objects
|
||||||
*/
|
*/
|
||||||
set<Object *>& Object::GetAliveObjects(void)
|
set<Object *> *Object::GetAliveObjects(void)
|
||||||
{
|
{
|
||||||
static set<Object *> aliveObjects;
|
static set<Object *> *aliveObjects = new set<Object *>();
|
||||||
return aliveObjects;
|
return aliveObjects;
|
||||||
}
|
}
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
|
@ -142,9 +142,9 @@ set<Object *>& Object::GetAliveObjects(void)
|
||||||
*
|
*
|
||||||
* @returns a mutex
|
* @returns a mutex
|
||||||
*/
|
*/
|
||||||
boost::mutex& Object::GetMutex(void)
|
boost::mutex *Object::GetMutex(void)
|
||||||
{
|
{
|
||||||
static boost::mutex mutex;
|
static boost::mutex *mutex = new boost::mutex();
|
||||||
return mutex;
|
return mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ private:
|
||||||
Object(const Object& other);
|
Object(const Object& other);
|
||||||
Object& operator=(const Object& rhs);
|
Object& operator=(const Object& rhs);
|
||||||
|
|
||||||
static boost::mutex& GetMutex(void);
|
static boost::mutex *GetMutex(void);
|
||||||
static set<Object *>& GetAliveObjects(void);
|
static set<Object *> *GetAliveObjects(void);
|
||||||
static vector<Object::Ptr>& GetHeldObjects(void);
|
static vector<Object::Ptr>& GetHeldObjects(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue