Page MenuHomePhabricator

PlanarFigure clone is in invalid state due to copy of unmanged/uncontrolled pointer for PlaneGeometry
Closed, ResolvedPublic

Description

Currently the clone of a PlanarFigure just does a simple raw copy of PlaneGeometry*. But the clone does not hold any managed pointer to the PlaneGeometry because the managed pointer to BaseData::Geometry does point to the clone of the geometry.
As soon as the original PlanarFigure is destroyed its clone is in an invalid state as the clone's PlaneGeometry points to garbage.

Proposed solution: in the copy constructor of planarfigure, explicitly reset the plane geometry based on its own geometry (like SetPlaneGeometry() would do).

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

floca triaged this task as Unbreak Now! priority.Sat, May 23, 11:45 PM
floca created this task.
floca added a revision: Restricted Differential Revision.Sun, May 24, 12:23 AM

But we should also discuss if we should have such an unsave construct in the class. I would judge it as premature optimization. The savest way is to over a getter that always casts the BaseData::Geometry to plane geometry and skip the unmanaed member completly. Was there an known issue, explicit plan why the current pattern was chosen?

floca claimed this task.Sun, May 24, 12:02 PM