Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit b7400d91 authored by lealv's avatar lealv
Browse files

FIXED - Memory leeks : correct some memory leeks into CamiTK framework. Processed with Valgrind.

- The benchmark Runtime was based on Revision 1899
- The benchmark Runtime was based on test exercise MISR
- Tests processed after corrections: open imp, load a mesh component, open an action, close imp.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1908 ec899d31-69d1-42ba-9299-647d76f65fb3
parent daef6d93
......@@ -47,6 +47,7 @@ Action::Action ( ActionExtension* extension ) : QObject() {
isEmbedded = true;
actionWidget = NULL;
autoUpdateProperties = false;
item = NULL;
}
// -------------------- destructor --------------------
......@@ -55,6 +56,12 @@ Action::~Action() {
foreach(Property* prop, parameterMap.values())
delete prop;
parameterMap.clear();
//delete History item
if( item )
{
delete item;
}
}
// -------------------- setName --------------------
......
......@@ -31,7 +31,6 @@
#include "Log.h"
// -- Qt stuff
#include <QTranslator>
#include <QDir>
namespace camitk {
......@@ -45,7 +44,7 @@ void ActionExtension::initResources() {
// remove any occurence of "-debug.dll" or ".so" or ".dylib" on the extension file name
actionExtensionDirName.remove("-debug.dll").remove(".so").remove(".dylib");
QString languageFile = ":/translate_" + actionExtensionDirName + "/translate/translate_" + selectedLanguage + ".qm";
QTranslator* translator = new QTranslator();
translator = new QTranslator();
if (!translator->load(languageFile))
CAMITK_WARNING("Application", "initResources", "Cannot load file: " + languageFile.toStdString())
else
......@@ -60,6 +59,12 @@ ActionExtension::~ActionExtension() {
if (toDelete->getName()!= "Quit")
delete toDelete;
}
//delete internationalization instance
if ( translator )
{
delete translator;
}
}
// -------------------- registerAction --------------------
......
......@@ -34,6 +34,7 @@
#include <QtPlugin>
#include <QPluginLoader>
#include <QObject>
#include <QTranslator>
namespace camitk {
class Action;
......@@ -102,6 +103,9 @@ protected:
private:
/// the shared lib (.so, .dll or .dylib) used to instanciate the ComponentExtension subclass instance
QString dynamicLibraryFileName;
/// Provide internationalization support for text output.
QTranslator* translator;
};
}
......
......@@ -39,7 +39,6 @@
#include <QFileDialog>
#include <QDomDocument>
#include <QTextStream>
#include <QTranslator>
// -- VTK stuff (only for updating progress bar via vtk filters)
#include <vtkAlgorithm.h>
......@@ -149,6 +148,13 @@ Application::Application(QString name, int & theArgc, char ** theArgv, bool auto
// ----------------- destructor --------------------
Application::~Application() {
// do not use the destructor to clean or free resources, but quitting()
if (translator)
{
//delete instance of internationalization support
delete translator;
}
}
// ----------------- destructor --------------------
......@@ -1010,7 +1016,7 @@ void Application::initResources() {
QString selectedLanguage = Application::getSelectedLanguage();
// Load the application translation
QTranslator* translator = new QTranslator();
translator = new QTranslator();
QString languageFile = ":/translate_" + getName().remove("camitk-") +"/translate/translate_" + selectedLanguage + ".qm";
if (!translator->load(languageFile))
CAMITK_WARNING("Application", "initResources", "Cannot load file: " + languageFile.toStdString())
......
......@@ -36,6 +36,7 @@
#include <QFileInfo>
#include <QStack>
#include <QList>
#include <QTranslator>
class vtkObject;
namespace camitk {
......@@ -356,6 +357,9 @@ private:
/// max number of recent document (default 10)
static int maxRecentDocuments;
/// Provide internationalization support for text output.
QTranslator* translator;
///@}
/// @name Components management
......
......@@ -615,6 +615,10 @@ RendererWidget::RendererWidget(QWidget* parent, ControlMode mode) : QVTKWidget(p
//---------------------- Destructor ------------------------
RendererWidget::~RendererWidget() {
// delete all properties
foreach(ScreenshotFormatInfo* sfi, screenshotMap.values())
delete sfi;
screenshotMap.clear();
}
//---------------------- buildScreenshotMap ------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment