Canvas: use weak pointer to protect parent element access.
Using a weak pointer is the best way to ensure no invalid pointer is used. This also fixes a possible crash in simgear::canvas::Element::getParentStyle on destructing canvas elements.
This commit is contained in:
@@ -740,7 +740,7 @@ namespace canvas
|
||||
Text::Text( const CanvasWeakPtr& canvas,
|
||||
const SGPropertyNode_ptr& node,
|
||||
const Style& parent_style,
|
||||
Element* parent ):
|
||||
ElementWeakPtr parent ):
|
||||
Element(canvas, node, parent_style, parent),
|
||||
_text( new Text::TextOSG(this) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user