X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?p=evaf;a=blobdiff_plain;f=src%2Fplugins%2FSdiWindow%2Ffactory.cpp;fp=src%2Fplugins%2FSdiWindow%2Ffactory.cpp;h=24aa0e55df0bf3f92aba358032119451ac9562e9;hp=a8a9a8b9c57f6d6959d1d5cbb2d9227d35f6eb7d;hb=de270ece1b764b19968e14420f538321f1c06b15;hpb=cf45ef016ce162419f74f9165c4267a184714956 diff --git a/src/plugins/SdiWindow/factory.cpp b/src/plugins/SdiWindow/factory.cpp index a8a9a8b..24aa0e5 100644 --- a/src/plugins/SdiWindow/factory.cpp +++ b/src/plugins/SdiWindow/factory.cpp @@ -3,7 +3,7 @@ * @brief SDI module's factory class * @author Enar Vaikene * - * Copyright (c) 2011 Enar Vaikene + * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * @@ -33,7 +33,6 @@ VER_EXPORT_VERSION_INFO() Factory::Factory() : Plugins::iPluginFactory() - , mPlugin(0) { setObjectName(QString("%1-Factory").arg(VER_MODULE_NAME_STR)); @@ -42,8 +41,7 @@ Factory::Factory() Factory::~Factory() { - if (mPlugin) - delete mPlugin; + mPlugin.reset(); EVAF_INFO("%s destroyed", qPrintable(objectName())); } @@ -52,7 +50,7 @@ QObject * Factory::create(QString const & name) { Q_UNUSED(name); - if (mPlugin == 0) - mPlugin = new Internal::SdiWindowPlugin; - return mPlugin; + if (!mPlugin) + mPlugin.reset(new Internal::SdiWindowPlugin); + return mPlugin.data(); }