Import 2017-06-07 23:51:09: master f698ed7f

Author Committer Branch Timestamp Parent
jcfr jcfr master 2015-07-17 02:51:12 master 6628ff87
Changeset

BUG: Fix memory leak in vtkMRMLSubjectHierarchyNode

This commit fixes the error(s) reported below by valgrind memcheck tool.

Valgrind was used on Ubuntu 14.04 against a Debug build of Slicer. It was
executed doing the following:
(1) Start a terminal with the appropriate environment: ./Slicer --gnome-terminal
(2) Start Slicer using valgrind: valgrind --log-file=2015-07-16-Slicer-memcheck.txt --tool=memcheck --leak-check=yes ./bin/SlicerApp-real --disable-python
(3) Load MRHead.nrrd file, open subject hierarchy module
(4) Exit Slicer and inspect valgrind log file

Valgrind error:

==1972== 7 bytes in 1 blocks are definitely lost in loss record 25 of 2,618
==1972== at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1972== by 0x10578B1E4: vtkMRMLSubjectHierarchyNode::SetOwnerPluginName(char const) (vtkMRMLSubjectHierarchyNode.cxx:216)
==1972== by 0x1052F96B2: qSlicerSubjectHierarchyPluginHandler::findAndSetOwnerPluginForSubjectHierarchyNode(vtkMRMLSubjectHierarchyNode
) (qSlicerSubjectHierarchyPluginHandler.cxx:298)
==1972== by 0x1052ECB61: qSlicerSubjectHierarchyPluginLogic::onNodeAdded(vtkObject, vtkObject) (qSlicerSubjectHierarchyPluginLogic.cxx:248)
==1972== by 0x1053090F2: qSlicerSubjectHierarchyPluginLogic::qt_static_metacall(QObject*, QMetaObject::Call, int, void) (moc_qSlicerSubjectHierarchyPluginLogic.cxx:71)
==1972== by 0x20AE9DC9: QMetaObject::activate(QObject, QMetaObject const, int, void
) (in /home/jcfr/Support/qt-everywhere-opensource-release-build-4.8.6/lib/libQtCore.so.4.8.6)
==1972== by 0xA88A5A9: ctkVTKConnection::emitExecute(vtkObject, vtkObject) (moc_ctkVTKConnection.cxx:109)
==1972== by 0xA87B88B: ctkVTKConnectionPrivate::execute(vtkObject, unsigned long, void, void) (ctkVTKConnection.cpp:418)
==1972== by 0xA87B615: ctkVTKConnectionPrivate::DoCallback(vtkObject
, unsigned long, void, void) (ctkVTKConnection.cpp:381)
==1972== by 0x28BF8D3E: vtkCallbackCommand::Execute(vtkObject, unsigned long, void) (vtkCallbackCommand.cxx:42)
==1972== by 0xE3DC3BA: vtkEventBroker::InvokeObservation(vtkObservation, unsigned long, void) (vtkEventBroker.cxx:838)
==1972== by 0xE3DBA10: vtkEventBroker::ProcessEvent(vtkObservation, vtkObject, unsigned long, void*) (vtkEventBroker.cxx:687)

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24450 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Modules/Loadable/SubjectHierarchy/MRML/vtkMRMLSubjectHierarchyNode.cxx Diff File