]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2980] Made LibraryHandle copy constructor and assignment operator private.
authorStephen Morris <stephen@isc.org>
Thu, 4 Jul 2013 11:53:09 +0000 (12:53 +0100)
committerStephen Morris <stephen@isc.org>
Thu, 4 Jul 2013 11:53:09 +0000 (12:53 +0100)
This reduces the risk of someone taking a copy and being left with
a "dangling pointer" to a callout manager.

src/lib/hooks/library_handle.h

index 6cf522c7d754038a502246c67399c8f7c3126a07..4fe47cd301e721859d1bb4f62c76cd34afe80414 100644 (file)
@@ -116,6 +116,25 @@ public:
     bool deregisterAllCallouts(const std::string& name);
 
 private:
+    /// @brief Copy constructor
+    ///
+    /// Private (with no implementation) as it makes no sense to copy an object
+    /// of this type.  All code receives a reference to an existing handle which
+    /// is tied to a particular CalloutManager.  Creating a copy of that handle
+    /// runs the risk of a "dangling pointer" to the original handle's callout
+    /// manager.
+    ///
+    /// @param Unused - should be the object to copy.
+    LibraryHandle(const LibraryHandle&);
+
+    /// @brief Assignment operator
+    ///
+    /// Declared private like the copy constructor for the same reasons. It too
+    /// has no implementation.
+    ///
+    /// @param Unused - should be the object to copy.
+    LibraryHandle& operator=(const LibraryHandle&);
+
     /// Back pointer to the collection object for the library
     CalloutManager* callout_manager_;