Skip to content

Commit

Permalink
Free the csv reader when the AnimationWindow is closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Nov 4, 2016
1 parent 93e1990 commit 74b8f7b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions OMEdit/OMEditGUI/Animation/AnimationWindow.cpp
Expand Up @@ -192,6 +192,13 @@ void AnimationWindow::setSpeedUpSlotFunction()
}
}

AnimationWindow::~AnimationWindow()
{
if (mpVisualizer) {
delete mpVisualizer;
}
}

/*!
* \brief AnimationWindow::setupViewWidget
* creates the widget for the osg viewer
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Animation/AnimationWindow.h
Expand Up @@ -66,6 +66,7 @@ class AnimationWindow : public QMainWindow, public osgViewer::CompositeViewer
Q_OBJECT
public:
AnimationWindow(PlotWindowContainer *pPlotWindowContainer);
~AnimationWindow();
QWidget* setupViewWidget();
void loadVisualization();
double getTimeFraction();
Expand Down
8 changes: 8 additions & 0 deletions OMEdit/OMEditGUI/Animation/VisualizerCSV.cpp
Expand Up @@ -30,6 +30,7 @@
/*
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

#include "VisualizerCSV.h"

VisualizerCSV::VisualizerCSV(const std::string& modelFile, const std::string& path)
Expand All @@ -38,6 +39,13 @@ VisualizerCSV::VisualizerCSV(const std::string& modelFile, const std::string& pa

}

VisualizerCSV::~VisualizerCSV()
{
if (mpCSVData) {
omc_free_csv_reader(mpCSVData);
}
}

void VisualizerCSV::initData()
{
VisualizerAbstract::initData();
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Animation/VisualizerCSV.h
Expand Up @@ -41,7 +41,7 @@ class VisualizerCSV : public VisualizerAbstract
public:
VisualizerCSV() = delete;
VisualizerCSV(const std::string& fileName, const std::string& path);
virtual ~VisualizerCSV() = default;
~VisualizerCSV();
VisualizerCSV(const VisualizerCSV& omvm) = delete;
VisualizerCSV& operator=(const VisualizerCSV& omvm) = delete;
void initData();
Expand Down

0 comments on commit 74b8f7b

Please sign in to comment.