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:
Thomas Geymayer
2015-09-30 11:54:19 +02:00
parent 3bfd0c872a
commit 00a20409f7
12 changed files with 25 additions and 36 deletions
+1 -1
View File
@@ -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) )
{