Skip to content
  • Shawn Waldon's avatar
    Fixed reference counting bug in vtkTransform · b47332bb
    Shawn Waldon authored
    There was a reference counting error in vtkTransformConcatenation when
    a transform was DeepCopy'ed and shortened and then DeepCopy'ed and lengthened
    using some of the same concatenated transforms.
    When the list of concatenated transforms was shortened, the values
    were not cleared out, letting pointers in the list that did not have a reference
    according to the reference counting.  Later, when the list was set to a larger
    list again and happenned to have the same transform at postion x, since there
    was already a reference to the transform in the list, it did not increment
    the reference count even though it should have.  This commit fixes this
    by setting pointers beyond the end of the list to NULL when DeepCopy shrinks the list.
    This commit also adds a regression test for that will segfault unless the
    bug is fixed due to a reference count that is accidentally decremented in
    a loop due to the bug. Running this test without this patch will segfault.
    Change-Id: I27d7c2097f85a2f8c1d6e8a0e8213d041cc83125