Import 2017-06-07 23:51:09: master 82a6a18e

Author Committer Branch Timestamp Parent
jcfr jcfr master 2014-07-15 17:56:02 master f3550312
Affected Issues 0003754: Scene close crashes at the end of python test SubjectHierarchyGenericTest
0003768: Slicer randomly hangs when closing or opening scene
Changeset

BUG: Fix infinite loop when opening or closing a scene

This commit fixes a regression introduced by commit r23191.

Commit r23191 simplified the code introducing smart pointer, typedefs and
also updated "SetNthNodeReferenceID" and "SetAndObserveNthNodeReferenceID"
so that they have have similar code. It turns out that after this update
new reference where systematically created with an ID being an empty string
instead of being a NULL string.

Commits following r23191 also updated the MRML reference system and
attempted to fix what was most likely an issue with the "SetNth" methods.
See r23192, r23196]. These commits fixes the behavior of the SetNth methods
so that setting a reference N was always returning the
associated reference if the reference n-1 was removed.

It turned out that these changes caused more trouble than expected and
to fully support the new behavior, major and backward incompatible changes
in the displayable and storable nodes and also in the scene serialization
would have occur. For that reason, commit r23395 and r23414 have been
integrated to revert all commit updating the behavior but keeping the
"smart pointer" and "typedefs" updates around.

It is only by "reverting" these last commit that the issue fixed by
this commit was revealed.

Note for later:

  • In method almost doing the same thing, do not comment code without
    clearly mentioning the reason.

  • If very similar functions are doing almost the same thing, re-factoring
    the code is key to reduce the maintenance burden.

Finally, this commit also update method "UpdateNthNodeReference"
to set the ReferencingNode (it was done before the commit introducing
smart pointers), the questions are "Why is this needed ?" and
"What is causing the reference to be dissociated from a referencing node?"

Fixes 0003754
Fixes 0003768

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

mod - Libs/MRML/Core/vtkMRMLNode.cxx Diff File