]> granicus.if.org Git - icinga2/commitdiff
Fix that custom attribute with function value cannot be cloned
authorMichael Friedrich <michael.friedrich@netways.de>
Wed, 11 Nov 2015 13:18:25 +0000 (14:18 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 11 Nov 2015 13:18:25 +0000 (14:18 +0100)
fixes #10583

lib/base/dictionary.cpp
lib/base/function.cpp
lib/base/function.hpp

index a62bddb3d12150cbaf410822835809c6165b291d..1b54c57af7b66aa34bfa806c3e8c4acb49b50e4f 100644 (file)
@@ -157,18 +157,18 @@ Dictionary::Ptr Dictionary::ShallowClone(void) const
 /**
  * Makes a deep clone of a dictionary
  * and its elements.
- * 
+ *
  * @returns a copy of the dictionary.
  */
 Object::Ptr Dictionary::Clone(void) const
 {
        Dictionary::Ptr dict = new Dictionary();
-       
+
        ObjectLock olock(this);
        BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
                dict->Set(kv.first, kv.second.Clone());
        }
-       
+
        return dict;
 }
 
index 6d0e850a649fe7c719cb21d919b622165db44227..d327defdefb74319c16bc8c088112ee9900859a2 100644 (file)
@@ -39,3 +39,7 @@ bool Function::IsSideEffectFree(void) const
        return m_SideEffectFree;
 }
 
+Object::Ptr Function::Clone(void) const
+{
+       return const_cast<Function *>(this);
+}
index 5d912ca89c4b71566b87fa90d3983b4df9a29e3c..ff0d8b24407f8c59f4d0e26fbc60be843faa2aeb 100644 (file)
@@ -49,6 +49,8 @@ public:
 
        static Object::Ptr GetPrototype(void);
 
+       virtual Object::Ptr Clone(void) const override;
+
 private:
        Callback m_Callback;
        bool m_SideEffectFree;