Fix that custom attribute with function value cannot be cloned

fixes #10583
This commit is contained in:
Michael Friedrich 2015-11-11 14:18:25 +01:00
parent 284a10150b
commit 545607be9f
3 changed files with 9 additions and 3 deletions

View File

@ -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;
} }

View File

@ -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);
}

View File

@ -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;