From ea520baf4e4a512744552a8528e3b41145796151 Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Sun, 22 Mar 2015 10:49:15 +0000 Subject: Fix a meory leak with modules that error during loading More Sconscript stuff --- src/SConscript | 4 ++-- src/plugincontainer.cpp | 4 ++-- src/savegamegamebyro.h | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/SConscript b/src/SConscript index 3dd5d450..1d69c1d6 100644 --- a/src/SConscript +++ b/src/SConscript @@ -66,9 +66,9 @@ env.AppendUnique(CPPDEFINES = [ '_UNICODE', '_CRT_SECURE_NO_WARNINGS', '_SCL_SECURE_NO_WARNINGS', - 'NOMINMAX', 'BOOST_DISABLE_ASSERTS', - 'NDEBUG' + 'NDEBUG', + 'QT_MESSAGELOGCONTEXT' ]) env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ]) diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index 6bc9d12b..e1d9d9f0 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -266,7 +266,7 @@ void PluginContainer::loadPlugins() loadCheck.flush(); QString pluginName = iter.filePath(); if (QLibrary::isLibrary(pluginName)) { - QPluginLoader *pluginLoader = new QPluginLoader(pluginName, this); + std::unique_ptr pluginLoader(new QPluginLoader(pluginName, this)); if (pluginLoader->instance() == nullptr) { m_FailedPlugins.push_back(pluginName); qCritical("failed to load plugin %s: %s", @@ -274,7 +274,7 @@ void PluginContainer::loadPlugins() } else { if (registerPlugin(pluginLoader->instance(), pluginName)) { qDebug("loaded plugin \"%s\"", qPrintable(pluginName)); - m_PluginLoaders.push_back(pluginLoader); + m_PluginLoaders.push_back(pluginLoader.release()); } else { m_FailedPlugins.push_back(pluginName); qWarning("plugin \"%s\" failed to load", qPrintable(pluginName)); diff --git a/src/savegamegamebyro.h b/src/savegamegamebyro.h index eedda6c2..e08e1044 100644 --- a/src/savegamegamebyro.h +++ b/src/savegamegamebyro.h @@ -22,10 +22,9 @@ along with Mod Organizer. If not, see . #include "savegame.h" -#include + #include #include -#include #include #include -- cgit v1.3.1