@@ -122,7 +122,8 @@ class ClassLoader : public std::enable_shared_from_this<ClassLoader>
122122 * @return A std::shared_ptr<Base> to newly created plugin object
123123 */
124124 template <class Base >
125- std::shared_ptr<Base> createInstance (const std::string & derived_class_name,
125+ std::shared_ptr<Base> createInstance (
126+ const std::string & derived_class_name,
126127 bool is_shared_ptr = false )
127128 {
128129 if (is_shared_ptr) {
@@ -152,19 +153,20 @@ class ClassLoader : public std::enable_shared_from_this<ClassLoader>
152153 * @return A std::unique_ptr<Base> to newly created plugin object.
153154 */
154155 template <class Base >
155- UniquePtr<Base> createUniqueInstance (const std::string & derived_class_name,
156+ UniquePtr<Base> createUniqueInstance (
157+ const std::string & derived_class_name,
156158 bool is_shared_ptr = false )
157159 {
158160 Base * raw = createRawInstance<Base>(derived_class_name, true );
159161 if (is_shared_ptr) {
160162 return std::unique_ptr<Base, DeleterType<Base>>(
161163 raw,
162- std::bind (&ClassLoader::onPluginDeletion<Base>, this , std::placeholders::_1)
164+ std::bind (&ClassLoader::onPluginDeletion<Base>, shared_from_this () , std::placeholders::_1)
163165 );
164166 } else {
165167 return std::unique_ptr<Base, DeleterType<Base>>(
166168 raw,
167- std::bind (&ClassLoader::onPluginDeletion<Base>, shared_from_this () , std::placeholders::_1)
169+ std::bind (&ClassLoader::onPluginDeletion<Base>, this , std::placeholders::_1)
168170 );
169171 }
170172 }
0 commit comments