Merge pull request #5071 from OPM/memory-fixes

Release of memory
This commit is contained in:
Magne Sjaastad 2019-11-21 07:10:07 +01:00
parent db869ccbd5
commit 72a5c6cfef
10 changed files with 43 additions and 18 deletions

View File

@ -153,6 +153,9 @@ RiaApplication::RiaApplication()
RiaApplication::~RiaApplication()
{
delete m_preferences;
delete m_project;
RiaFontCache::clear();
}
//--------------------------------------------------------------------------------------------------

View File

@ -129,3 +129,11 @@ RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize( int pointSize )
}
return closestEnumValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFontCache::clear()
{
ms_fonts.clear();
}

View File

@ -56,6 +56,8 @@ public:
static int pointSizeFromFontSizeEnum( FontSize fontSize );
static FontSize fontSizeEnumFromPointSize( int pointSize );
static void clear();
private:
static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
};

View File

@ -33,6 +33,8 @@
#include <QAction>
#include <memory>
CAF_CMD_SOURCE_INIT( RicEditSummaryPlotFeature, "RicEditSummaryPlotFeature" );
//--------------------------------------------------------------------------------------------------
@ -60,9 +62,14 @@ void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot()
//--------------------------------------------------------------------------------------------------
RicSummaryCurveCreatorDialog* RicEditSummaryPlotFeature::curveCreatorDialog()
{
static RicSummaryCurveCreatorDialog* singletonDialog = new RicSummaryCurveCreatorDialog( nullptr );
static std::unique_ptr<RicSummaryCurveCreatorDialog> singletonDialog;
return singletonDialog;
if ( !singletonDialog )
{
singletonDialog.reset( new RicSummaryCurveCreatorDialog( nullptr ) );
}
return singletonDialog.get();
}
//--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@
RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog( QWidget* parent )
: QDialog( parent, RiuTools::defaultDialogFlags() )
{
m_curveCreatorSplitterUi = new RicSummaryCurveCreatorSplitterUi( this );
m_curveCreatorSplitterUi.reset( new RicSummaryCurveCreatorSplitterUi( this ) );
QWidget* propertyWidget = m_curveCreatorSplitterUi->getOrCreateWidget( this );
@ -46,7 +46,7 @@ RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog( QWidget* parent )
setWindowTitle( "Plot Editor" );
resize( 1200, 800 );
connect( m_curveCreatorSplitterUi, SIGNAL( signalCloseButtonPressed() ), this, SLOT( accept() ) );
connect( m_curveCreatorSplitterUi.get(), SIGNAL( signalCloseButtonPressed() ), this, SLOT( accept() ) );
connect( this, SIGNAL( finished( int ) ), this, SLOT( slotDialogFinished() ) );
}
@ -54,7 +54,10 @@ RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog( QWidget* parent )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicSummaryCurveCreatorDialog::~RicSummaryCurveCreatorDialog() {}
RicSummaryCurveCreatorDialog::~RicSummaryCurveCreatorDialog()
{
m_curveCreatorSplitterUi->setPdmObject( nullptr );
}
//--------------------------------------------------------------------------------------------------
///

View File

@ -20,6 +20,8 @@
#include <QDialog>
#include <memory>
namespace caf
{
class PdmObject;
@ -47,5 +49,5 @@ private slots:
void slotDialogFinished();
private:
RicSummaryCurveCreatorSplitterUi* m_curveCreatorSplitterUi;
std::unique_ptr<RicSummaryCurveCreatorSplitterUi> m_curveCreatorSplitterUi;
};

View File

@ -65,6 +65,10 @@ void RifEclipseSummaryTools::findSummaryFiles( const QString& inputFile, QString
std::string extention;
if ( myExtention ) extention = myExtention;
free( myExtention );
free( myBase );
free( myPath );
if ( path.isEmpty() || base.isEmpty() ) return;
char* myHeaderFile = nullptr;

View File

@ -205,13 +205,7 @@ RimProject::RimProject( void )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimProject::~RimProject( void )
{
close();
oilFields.deleteAllChildObjects();
if ( scriptCollection() ) delete scriptCollection();
}
RimProject::~RimProject( void ) {}
//--------------------------------------------------------------------------------------------------
///

View File

@ -52,7 +52,7 @@ RiuQwtPlotCurve::RiuQwtPlotCurve( const QString& title )
m_symbolSkipPixelDistance = 10.0f;
m_errorBars = new QwtPlotIntervalCurve();
m_errorBars = std::unique_ptr<QwtPlotIntervalCurve>( new QwtPlotIntervalCurve() );
m_errorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve );
m_errorBars->setSymbol( new QwtIntervalSymbol( QwtIntervalSymbol::Bar ) );
m_errorBars->setItemAttribute( QwtPlotItem::Legend, false );

View File

@ -23,6 +23,8 @@
#include "qwt_plot_intervalcurve.h"
#include "qwt_symbol.h"
#include <memory>
class RiuErrorBarsQwtPlotCurve;
//==================================================================================================
@ -150,10 +152,10 @@ private:
std::vector<std::pair<size_t, size_t>> m_polyLineStartStopIndices;
float m_symbolSkipPixelDistance;
bool m_showErrorBars;
QwtPlotIntervalCurve* m_errorBars;
QwtPlot* m_attachedToPlot;
bool m_blackAndWhiteLegendIcon;
bool m_showErrorBars;
std::unique_ptr<QwtPlotIntervalCurve> m_errorBars;
QwtPlot* m_attachedToPlot;
bool m_blackAndWhiteLegendIcon;
std::vector<QString> m_perPointLabels;
};