Browse Source

[COR] Correction of some memory leaks. Warning about in Qt plugins are not unloaded when application exit. So destructor of plugin is not called. A check of what is doing in plugin destructor must be made. Maybe there should be have nothing in destructor of plugin !!!

master
Ulrich Van Den Hekke 11 years ago
parent
commit
34ffbaed1f
  1. 2
      ext/qcodeedit/lib/qpanellayout.cpp
  2. 3
      framework/codecompletion/pool.cpp
  3. 3
      framework/core/errordockimpl.cpp
  4. 2
      framework/core/errordockimpl.h
  5. 15
      framework/core/filewatcher.cpp
  6. 4
      framework/core/filewatcher.h
  7. 8
      framework/editors/textfileeditor.cpp
  8. 2
      framework/editors/textfileeditor.h
  9. 1
      framework/editors/xinxcodeedit.cpp
  10. 4
      framework/plugins/xinxpluginsloader.cpp
  11. 3
      framework/search/searchdockimpl.cpp
  12. 2
      framework/search/searchdockimpl.h
  13. 10
      framework/session/sessionmanager.cpp
  14. 3
      framework/versioncontrol/rcslogdockimpl.cpp
  15. 2
      framework/versioncontrol/rcslogdockimpl.h
  16. 1
      plugins/core/plugindefinition/coreplugin.cpp
  17. 9
      plugins/cvsplugin/pluginsettings.cpp
  18. 2
      plugins/cvsplugin/pluginsettings.h
  19. 2
      plugins/generix/docks/project/generixprojectdock.cpp
  20. 2
      plugins/generix/plugindefinition/generix.cpp
  21. 8
      plugins/services/webservicesfiletype.h
  22. 2
      plugins/svnplugin/rcs_svn.cpp

2
ext/qcodeedit/lib/qpanellayout.cpp

@ -260,7 +260,7 @@ QLayoutItem* QPanelLayout::takeAt(int idx)
{
if ( (idx >= 0) && (idx < m_list.size()) )
{
PanelWrapper *layoutStruct = m_list.takeAt(idx);
QScopedPointer<PanelWrapper> layoutStruct(m_list.takeAt(idx));
return layoutStruct->item;
}

3
framework/codecompletion/pool.cpp

@ -55,7 +55,8 @@ Pool::Pool() : d(new PrivatePool)
Pool::~Pool()
{
qDeleteAll(d->_factories.values());
qDeleteAll(d->_parsers.values());
}
void Pool::updateParsers()

3
framework/core/errordockimpl.cpp

@ -32,12 +32,11 @@
/* ErrorDockWidgetImpl */
ErrorDockWidgetImpl::ErrorDockWidgetImpl(QWidget * parent) : AbstractMessageDockWidget(parent)
ErrorDockWidgetImpl::ErrorDockWidgetImpl(QWidget * parent) : AbstractMessageDockWidget(parent), _widget(new Ui::ErrorDockWidget)
{
setWindowTitle(tr("Warnings/Errors"));
setWindowIcon(QIcon(":/images/warning.png"));
_widget = new Ui::ErrorDockWidget();
_widget->setupUi(this);
QAction * clearAction = new QAction(tr("Clear the errors"), this);

2
framework/core/errordockimpl.h

@ -43,7 +43,7 @@ public slots:
protected slots:
void doubleClicked(const QModelIndex & index);;
private:
Ui::ErrorDockWidget * _widget;
QScopedPointer<Ui::ErrorDockWidget> _widget;
};
#endif /* ERRORDOCKWIDGETIMPL_H */

15
framework/core/filewatcher.cpp

@ -219,19 +219,18 @@ void PrivateFilesWatcher::removePaths(const QStringList & paths)
* Create a FileWatcher with a file name
* \param filename The file name to watch.
*/
FileWatcher::FileWatcher(const QString & filename)
FileWatcher::FileWatcher(const QString & filename) : d(new PrivateFileWatcher(this))
{
d = new PrivateFileWatcher(this);
d->m_filename = filename;
connect(FileWatcherManager::instance(), SIGNAL(fileChanged(QString)), d, SLOT(fileChanged(QString)), Qt::QueuedConnection);
connect(FileWatcherManager::instance(), SIGNAL(fileChanged(QString)), d.data(), SLOT(fileChanged(QString)), Qt::QueuedConnection);
FileWatcherManager::instance()->addFile(filename);
}
/*! Destroy the FileWatcher */
FileWatcher::~FileWatcher()
{
delete d;
}
/*!
@ -274,17 +273,15 @@ void FileWatcher::activate()
/*!
* Create a FilesWatcher with a file name
*/
FilesWatcher::FilesWatcher(QObject* parent) : QObject(parent)
FilesWatcher::FilesWatcher(QObject* parent) : QObject(parent), d(new PrivateFilesWatcher(this))
{
d = new PrivateFilesWatcher(this);
connect(FileWatcherManager::instance(), SIGNAL(fileChanged(QString)), d, SLOT(fileChanged(QString)), Qt::QueuedConnection);
connect(FileWatcherManager::instance(), SIGNAL(fileChanged(QString)), d.data(), SLOT(fileChanged(QString)), Qt::QueuedConnection);
}
/*! Destroy the FilesWatcher */
FilesWatcher::~FilesWatcher()
{
delete d;
}
void FilesWatcher::addPath(const QString& path)

4
framework/core/filewatcher.h

@ -42,7 +42,7 @@ public:
signals:
void fileChanged();
protected:
PrivateFileWatcher * d;
QScopedPointer<PrivateFileWatcher> d;
friend class PrivateFileWatcher;
};
@ -60,7 +60,7 @@ public:
signals:
void fileChanged(const QString & path);
private:
PrivateFilesWatcher * d;
QScopedPointer<PrivateFilesWatcher> d;
friend class PrivateFilesWatcher;
};

8
framework/editors/textfileeditor.cpp

@ -139,15 +139,15 @@ TextFileEditor::~TextFileEditor()
void TextFileEditor::initObjects()
{
_modification_timer = new QTimer();
_modification_timer.reset(new QTimer);
_modification_timer->setSingleShot(true);
_modification_timer->setInterval(XINXConfig::self()->config().editor.automaticModelRefreshTimeout);
connect(_modification_timer, SIGNAL(timeout()), this, SLOT(updateModel()));
connect(_modification_timer.data(), SIGNAL(timeout()), this, SLOT(updateModel()));
_move_timer = new QTimer();
_move_timer.reset(new QTimer);
_move_timer->setSingleShot(true);
_move_timer->setInterval(100);
connect(_move_timer, SIGNAL(timeout()), this, SLOT(updateContext()));
connect(_move_timer.data(), SIGNAL(timeout()), this, SLOT(updateContext()));
// Set the internal editor used by textfileeditor
if (! m_view)

2
framework/editors/textfileeditor.h

@ -154,7 +154,7 @@ private slots:
private:
void initObjects();
QTimer * _modification_timer, * _move_timer;
QScopedPointer<QTimer> _modification_timer, _move_timer;
QString m_codec;
XinxCodeEdit * m_view;

1
framework/editors/xinxcodeedit.cpp

@ -165,6 +165,7 @@ void XinxCodeEdit::init(bool action)
//! Destroy the object
XinxCodeEdit::~XinxCodeEdit()
{
delete m_matchingText;
m_editor->editor()->setInputBinding(0);
m_editor->editor()->removeInputBinding(this);
delete m_editor;

4
framework/plugins/xinxpluginsloader.cpp

@ -397,7 +397,9 @@ void XinxPluginsLoader::addPlugin(QObject * plugin, bool staticLoaded)
void XinxPluginsLoader::loadPlugins()
{
foreach(QObject * plugin, QPluginLoader::staticInstances())
addPlugin(plugin, true);
{
addPlugin(plugin, true);
}
foreach(const QString & directory, QDir::searchPaths("plugins"))
{

3
framework/search/searchdockimpl.cpp

@ -80,12 +80,11 @@ void SearchLogWidgetDelegate::paint(QPainter * painter, const QStyleOptionViewIt
/* SearchDockWidgetImpl */
SearchDockWidgetImpl::SearchDockWidgetImpl(QWidget * parent) : AbstractMessageDockWidget(parent)
SearchDockWidgetImpl::SearchDockWidgetImpl(QWidget * parent) : AbstractMessageDockWidget(parent), _widget(new Ui::SearchDockWidget)
{
setWindowTitle(tr("Search Result"));
setWindowIcon(QIcon(":/images/find.png"));
_widget = new Ui::SearchDockWidget();
_widget->setupUi(this);
_widget->m_searchTreeWidget->setItemDelegate(new SearchLogWidgetDelegate);

2
framework/search/searchdockimpl.h

@ -47,7 +47,7 @@ public slots:
protected slots:
void doubleClicked(const QModelIndex & index);;
private:
Ui::SearchDockWidget * _widget;
QScopedPointer<Ui::SearchDockWidget> _widget;
};
#endif /* SEARCHDOCKIMPL_H */

10
framework/session/sessionmanager.cpp

@ -21,6 +21,7 @@
#include "sessionmanager_p.h"
#include "session.h"
#include <project/xinxprojectmanager.h>
#include <project/xinxprojectprojectexception.h>
#include <editors/editormanager.h>
#include <QInputDialog>
#include <QMessageBox>
@ -226,7 +227,14 @@ void SessionManager::restoreSession(const QString & sessionName)
const QString currentProjectPath = d->_current_session->currentProjectPath();
foreach(const QString & projectPath, d->_current_session->openedProject())
{
XinxProject::Manager::self()->openProject(projectPath);
try
{
XinxProject::Manager::self()->openProject(projectPath);
}
catch (XinxProject::ProjectException e)
{
qWarning() << e.getMessage() << " : " << projectPath;
}
}
if (! currentProjectPath.isEmpty())

3
framework/versioncontrol/rcslogdockimpl.cpp

@ -30,12 +30,11 @@
/* RCSLogDockWidgetImpl */
RCSLogDockWidgetImpl::RCSLogDockWidgetImpl(QWidget * parent) : AbstractMessageDockWidget(parent)
RCSLogDockWidgetImpl::RCSLogDockWidgetImpl(QWidget * parent) : AbstractMessageDockWidget(parent), _widget(new Ui::RCSDockWidget)
{
setWindowTitle(tr("Version Control Logs"));
setWindowIcon(QIcon(":/images/ecmascript.png"));
_widget = new Ui::RCSDockWidget();
_widget->setupUi(this);
_widget->m_progressBar->hide();

2
framework/versioncontrol/rcslogdockimpl.h

@ -49,7 +49,7 @@ public:
private slots:
void timeout();
private:
Ui::RCSDockWidget * _widget;
QScopedPointer<Ui::RCSDockWidget> _widget;
bool _rcsVisible;
QTimer * _timer;
};

1
plugins/core/plugindefinition/coreplugin.cpp

@ -79,6 +79,7 @@ CorePlugin::CorePlugin() : m_dock(0)
CorePlugin::~CorePlugin()
{
qDebug() << "Destroy plugin CorePlugin";
qDeleteAll(m_fileTypes);
delete SelfWebPluginSettings::self();
}

9
plugins/cvsplugin/pluginsettings.cpp

@ -58,20 +58,19 @@ void PrivatePluginSettings::deleteSettings()
/* PluginSettings */
PluginSettings::PluginSettings(const PluginSettings & origine)
PluginSettings::PluginSettings(const PluginSettings & origine) : d(new PrivatePluginSettings(this))
{
d = new PrivatePluginSettings(this);
d->m_globals = origine.d->m_globals;
}
PluginSettings::PluginSettings()
PluginSettings::PluginSettings() : d(new PrivatePluginSettings(this))
{
d = new PrivatePluginSettings(this);
}
PluginSettings::~PluginSettings()
{
delete d;
}
PluginSettings&PluginSettings::operator=(const PluginSettings& p)

2
plugins/cvsplugin/pluginsettings.h

@ -47,7 +47,7 @@ protected:
virtual void setSettingsGlobals(PluginSettingsSettings * settings, const QString & path, PluginSettings::struct_globals value);
private:
PrivatePluginSettings * d;
QScopedPointer<PrivatePluginSettings> d;
friend class PrivatePluginSettings;
};
#endif // _PLUGINSETTINGS_H_

2
plugins/generix/docks/project/generixprojectdock.cpp

@ -133,7 +133,7 @@ QSize BusinessViewListDelegate::sizeHint(const QStyleOptionViewItem &option, con
/* GenerixProjectDockImpl */
GenerixProjectDockImpl::GenerixProjectDockImpl(QWidget * parent) : QWidget(parent)
GenerixProjectDockImpl::GenerixProjectDockImpl(QWidget * parent) : QWidget(parent), m_editorIndex(-1)
{
setupUi(this);
setWindowTitle(tr("Generix Business View"));

2
plugins/generix/plugindefinition/generix.cpp

@ -93,6 +93,8 @@ GenerixPlugin::GenerixPlugin() : m_dock(0)
GenerixPlugin::~GenerixPlugin()
{
qDebug() << "Destroy the plugin GenerixPlugin";
qDeleteAll(m_fileTypes);
}
bool GenerixPlugin::initializePlugin(const QString & lang)

8
plugins/services/webservicesfiletype.h

@ -38,15 +38,17 @@ public:
virtual QString description()
{
return tr("Web Services Stream");
};
}
virtual QString match()
{
return "*.fws";
};
}
virtual QString icon()
{
return ":/services/images/typefws.png";
};
}
virtual AbstractEditor * createEditor()
{

2
plugins/svnplugin/rcs_svn.cpp

@ -383,8 +383,8 @@ RCS_SVN::RCS_SVN(const QString & basePath) : RCS(basePath)
RCS_SVN::~RCS_SVN()
{
delete m_context;
delete m_client;
delete m_context;
}
RCS::rcsFeatures RCS_SVN::features() const

Loading…
Cancel
Save