Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 2aa51bc3 authored by schultezub's avatar schultezub
Browse files

* fixed various memory leaks

 * added AbstractProperty::(de)init and HasPropertyCollection::(de)initAllProperties

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@213 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent b7aa2254
...@@ -17,7 +17,7 @@ namespace TUMVis { ...@@ -17,7 +17,7 @@ namespace TUMVis {
} }
IntPropertyWidget::~IntPropertyWidget() { IntPropertyWidget::~IntPropertyWidget() {
static_cast<IntProperty*>(_property)->s_minMaxChanged.disconnect(this);
} }
void IntPropertyWidget::updateWidgetFromProperty() { void IntPropertyWidget::updateWidgetFromProperty() {
......
...@@ -17,7 +17,7 @@ namespace TUMVis { ...@@ -17,7 +17,7 @@ namespace TUMVis {
, _spinDomainLeft(0) , _spinDomainLeft(0)
, _spinDomainRight(0) , _spinDomainRight(0)
, _btnEditTF(0) , _btnEditTF(0)
,_dockWidget(0) , _dockWidget(0)
, _editor(0) , _editor(0)
{ {
_widget = new QWidget(this); _widget = new QWidget(this);
...@@ -54,7 +54,6 @@ namespace TUMVis { ...@@ -54,7 +54,6 @@ namespace TUMVis {
TransferFunctionPropertyWidget::~TransferFunctionPropertyWidget() { TransferFunctionPropertyWidget::~TransferFunctionPropertyWidget() {
delete _dockWidget; delete _dockWidget;
delete _editor;
} }
void TransferFunctionPropertyWidget::updateWidgetFromProperty() { void TransferFunctionPropertyWidget::updateWidgetFromProperty() {
......
...@@ -48,8 +48,6 @@ namespace TUMVis { ...@@ -48,8 +48,6 @@ namespace TUMVis {
for (std::vector<AbstractPipeline*>::iterator it = _pipelines.begin(); it != _pipelines.end(); ++it) { for (std::vector<AbstractPipeline*>::iterator it = _pipelines.begin(); it != _pipelines.end(); ++it) {
delete *it; delete *it;
} }
// TODO: _mainWindow is a Qt pointer and does not need to be deleted - right?
} }
void TumVisApplication::init() { void TumVisApplication::init() {
...@@ -113,6 +111,8 @@ namespace TUMVis { ...@@ -113,6 +111,8 @@ namespace TUMVis {
tgt::QtContextManager::deinit(); tgt::QtContextManager::deinit();
tgt::deinit(); tgt::deinit();
delete _mainWindow;
_initialized = false; _initialized = false;
} }
......
...@@ -130,6 +130,13 @@ namespace TUMVis { ...@@ -130,6 +130,13 @@ namespace TUMVis {
void TumVisPainter::deinit() { void TumVisPainter::deinit() {
ShdrMgr.dispose(_copyShader); ShdrMgr.dispose(_copyShader);
if (_pipeline != 0) {
_pipeline->s_renderTargetChanged.disconnect(this);
if (getCanvas()->getEventHandler() != 0)
getCanvas()->getEventHandler()->removeListener(_pipeline);
_pipeline = 0;
}
} }
void TumVisPainter::setPipeline(VisualizationPipeline* pipeline) { void TumVisPainter::setPipeline(VisualizationPipeline* pipeline) {
......
...@@ -15,18 +15,22 @@ namespace TUMVis { ...@@ -15,18 +15,22 @@ namespace TUMVis {
} }
void AbstractPipeline::init() { void AbstractPipeline::init() {
initAllProperties();
// initialize all processors: // initialize all processors:
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) { for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
try { try {
(*it)->init(); (*it)->init();
} }
catch (tgt::Exception& e) { catch (tgt::Exception& e) {
LERROR("Caught Exception during initialization of processor: " << e.what()); LERROR("Caught Exception during initialization of processor: " << e.what());
} }
} }
} }
void AbstractPipeline::deinit() { void AbstractPipeline::deinit() {
deinitAllProperties();
// deinitialize all processors: // deinitialize all processors:
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) { for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
try { try {
......
...@@ -28,9 +28,11 @@ namespace TUMVis { ...@@ -28,9 +28,11 @@ namespace TUMVis {
} }
void AbstractProcessor::init() { void AbstractProcessor::init() {
initAllProperties();
} }
void AbstractProcessor::deinit() { void AbstractProcessor::deinit() {
deinitAllProperties();
} }
......
...@@ -59,7 +59,7 @@ namespace TUMVis { ...@@ -59,7 +59,7 @@ namespace TUMVis {
virtual void init(); virtual void init();
/** /**
* Deinitializes this processors. * Deinitializes this processor.
* \note When overwriting this method, make sure to call the base class version first. * \note When overwriting this method, make sure to call the base class version first.
*/ */
virtual void deinit(); virtual void deinit();
......
...@@ -55,4 +55,12 @@ namespace TUMVis { ...@@ -55,4 +55,12 @@ namespace TUMVis {
_inUse = false; _inUse = false;
} }
void AbstractProperty::init() {
}
void AbstractProperty::deinit() {
}
} }
...@@ -32,6 +32,18 @@ namespace TUMVis { ...@@ -32,6 +32,18 @@ namespace TUMVis {
virtual ~AbstractProperty(); virtual ~AbstractProperty();
/**
* Initializes the property.
* Everything that requires a valid OpenGL context or is otherwise expensive gets in here.
*/
virtual void init();
/**
* Deinitializes this property.
* Everything that requires a valid OpenGL context gets in here instead into the dtor.
*/
virtual void deinit();
/** /**
* Returns the property name. * Returns the property name.
* \return _name * \return _name
......
...@@ -74,4 +74,16 @@ namespace TUMVis { ...@@ -74,4 +74,16 @@ namespace TUMVis {
} }
} }
void HasPropertyCollection::initAllProperties() {
for (PropertyCollection::iterator it = _properties.begin(); it != _properties.end(); ++it) {
(*it)->init();
}
}
void HasPropertyCollection::deinitAllProperties() {
for (PropertyCollection::iterator it = _properties.begin(); it != _properties.end(); ++it) {
(*it)->deinit();
}
}
} }
\ No newline at end of file
...@@ -71,6 +71,16 @@ namespace TUMVis { ...@@ -71,6 +71,16 @@ namespace TUMVis {
*/ */
virtual void unlockAllProperties(); virtual void unlockAllProperties();
/**
* Initializes all properties.
*/
virtual void initAllProperties();
/**
* Deinitializes all properties.
*/
virtual void deinitAllProperties();
/** /**
* Slot getting called when one of the observed properties changed and notifies its observers. * Slot getting called when one of the observed properties changed and notifies its observers.
* \param prop Property that emitted the signal * \param prop Property that emitted the signal
......
...@@ -13,7 +13,8 @@ namespace TUMVis { ...@@ -13,7 +13,8 @@ namespace TUMVis {
} }
TransferFunctionProperty::~TransferFunctionProperty() { TransferFunctionProperty::~TransferFunctionProperty() {
_transferFunction->s_changed.disconnect(this);
delete _transferFunction;
} }
AbstractTransferFunction* TransferFunctionProperty::getTF() { AbstractTransferFunction* TransferFunctionProperty::getTF() {
...@@ -24,4 +25,8 @@ namespace TUMVis { ...@@ -24,4 +25,8 @@ namespace TUMVis {
s_changed(this); s_changed(this);
} }
void TransferFunctionProperty::deinit() {
_transferFunction->deinit();
}
} }
...@@ -22,6 +22,8 @@ namespace TUMVis { ...@@ -22,6 +22,8 @@ namespace TUMVis {
**/ **/
virtual ~TransferFunctionProperty(); virtual ~TransferFunctionProperty();
/// \overload
virtual void deinit();
AbstractTransferFunction* getTF(); AbstractTransferFunction* getTF();
......
...@@ -32,10 +32,12 @@ namespace TUMVis { ...@@ -32,10 +32,12 @@ namespace TUMVis {
} }
void SliceExtractor::init() { void SliceExtractor::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "modules/vis/sliceextractor.frag", "", false); _shader = ShdrMgr.loadSeparate("core/glsl/passthrough.vert", "modules/vis/sliceextractor.frag", "", false);
} }
void SliceExtractor::deinit() { void SliceExtractor::deinit() {
VisualizationProcessor::deinit();
ShdrMgr.dispose(_shader); ShdrMgr.dispose(_shader);
} }
......
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