mirror of https://github.com/Icinga/icinga2.git
Fix that custom attribute with function value cannot be cloned
fixes #10583
This commit is contained in:
parent
284a10150b
commit
545607be9f
|
@ -157,18 +157,18 @@ Dictionary::Ptr Dictionary::ShallowClone(void) const
|
||||||
/**
|
/**
|
||||||
* Makes a deep clone of a dictionary
|
* Makes a deep clone of a dictionary
|
||||||
* and its elements.
|
* and its elements.
|
||||||
*
|
*
|
||||||
* @returns a copy of the dictionary.
|
* @returns a copy of the dictionary.
|
||||||
*/
|
*/
|
||||||
Object::Ptr Dictionary::Clone(void) const
|
Object::Ptr Dictionary::Clone(void) const
|
||||||
{
|
{
|
||||||
Dictionary::Ptr dict = new Dictionary();
|
Dictionary::Ptr dict = new Dictionary();
|
||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
|
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
|
||||||
dict->Set(kv.first, kv.second.Clone());
|
dict->Set(kv.first, kv.second.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,3 +39,7 @@ bool Function::IsSideEffectFree(void) const
|
||||||
return m_SideEffectFree;
|
return m_SideEffectFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object::Ptr Function::Clone(void) const
|
||||||
|
{
|
||||||
|
return const_cast<Function *>(this);
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ public:
|
||||||
|
|
||||||
static Object::Ptr GetPrototype(void);
|
static Object::Ptr GetPrototype(void);
|
||||||
|
|
||||||
|
virtual Object::Ptr Clone(void) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Callback m_Callback;
|
Callback m_Callback;
|
||||||
bool m_SideEffectFree;
|
bool m_SideEffectFree;
|
||||||
|
|
Loading…
Reference in New Issue