Fix some memory leaks

Task-number: QTCREATORBUG-7645

Change-Id: I34253d063a20ebf927bf651cf68af4fe1b71bc89
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Orgad Shaneh
2012-07-19 22:26:45 +03:00
committed by hjk
parent ebc63659c1
commit cf9895ae01
7 changed files with 21 additions and 3 deletions

View File

@@ -233,6 +233,11 @@ HistoryCompleter::HistoryCompleter(QSettings *settings, QObject *parent)
view->setItemDelegate(delegate);
}
HistoryCompleter::~HistoryCompleter()
{
delete d;
}
int HistoryCompleter::historySize() const
{
return d->model->rowCount();

View File

@@ -49,6 +49,7 @@ class QTCREATOR_UTILS_EXPORT HistoryCompleter : public QCompleter
public:
HistoryCompleter(QSettings *settings, QObject *parent);
~HistoryCompleter();
int historySize() const;
int maximalHistorySize() const;
void setMaximalHistorySize(int numberOfEntries);

View File

@@ -665,7 +665,7 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode
QString actionName = tool->actionName(mode);
Id menuGroup = tool->menuGroup(mode);
Id actionId = tool->actionId(mode);
QAction *action = new QAction(actionName, 0);
QAction *action = new QAction(actionName, this);
Command *command = Core::ActionManager::registerAction(action, actionId, Context(C_GLOBAL));
m_menu->addAction(command, menuGroup);
command->action()->setData(int(StartLocal));

View File

@@ -1757,7 +1757,9 @@ ExtensionSystem::IPlugin::ShutdownFlag FakeVimPlugin::aboutToShutdown()
void FakeVimPlugin::extensionsInitialized()
{
d->m_statusBar = new Core::StatusBarWidget;
d->m_statusBar->setWidget(new MiniBuffer);
MiniBuffer *miniBuffer = new MiniBuffer;
addAutoReleasedObject(miniBuffer);
d->m_statusBar->setWidget(miniBuffer);
d->m_statusBar->setPosition(StatusBarWidget::Last);
addAutoReleasedObject(d->m_statusBar);
}

View File

@@ -379,6 +379,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
this, SLOT(updateWelcomePage()));
d->m_proWindow = new ProjectWindow;
addAutoReleasedObject(d->m_proWindow);
Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::Context projecTreeContext(Constants::C_PROJECT_TREE);

View File

@@ -54,6 +54,7 @@ public:
CodeStylePoolPrivate()
: m_factory(0)
{}
~CodeStylePoolPrivate();
QString generateUniqueId(const QString &id) const;
@@ -65,6 +66,11 @@ public:
QString m_settingsPath;
};
CodeStylePoolPrivate::~CodeStylePoolPrivate()
{
delete m_factory;
}
QString CodeStylePoolPrivate::generateUniqueId(const QString &id) const
{
if (!id.isEmpty() && !m_idToCodeStyle.contains(id))

View File

@@ -126,11 +126,13 @@ private:
QHBoxLayout * buttonLayout;
QList<QObject*> m_pluginList;
int m_activePlugin;
NetworkAccessManagerFactory *m_networkAccessManagerFactory;
};
// --- WelcomeMode
WelcomeMode::WelcomeMode() :
m_activePlugin(0)
, m_networkAccessManagerFactory(new NetworkAccessManagerFactory)
{
setDisplayName(tr("Welcome"));
setIcon(QIcon(QLatin1String(Core::Constants::ICON_QTLOGO_32)));
@@ -181,6 +183,7 @@ WelcomeMode::~WelcomeMode()
QSettings *settings = Core::ICore::settings();
settings->setValue(QLatin1String(currentPageSettingsKeyC), activePlugin());
delete m_modeWidget;
delete m_networkAccessManagerFactory;
}
bool sortFunction(Utils::IWelcomePage * a, Utils::IWelcomePage *b)
@@ -235,7 +238,7 @@ void WelcomeMode::initPlugins()
engine->setImportPathList(importPathList);
if (!debug)
engine->setOutputWarningsToStandardError(false);
engine->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory);
engine->setNetworkAccessManagerFactory(m_networkAccessManagerFactory);
QString pluginPath = QCoreApplication::applicationDirPath();
#ifdef Q_OS_MAC
pluginPath += QLatin1String("/../PlugIns");