From 37d0c19f7c389d35a59170585cebe421d82ac2de Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Thu, 27 Sep 2012 14:41:00 +0200 Subject: [PATCH] Canvas: Make path destroying more robust --- src/Canvas/elements/path.cxx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Canvas/elements/path.cxx b/src/Canvas/elements/path.cxx index 65031cfd2..a80ba70a2 100644 --- a/src/Canvas/elements/path.cxx +++ b/src/Canvas/elements/path.cxx @@ -56,8 +56,25 @@ namespace canvas virtual ~PathDrawable() { - vgDestroyPath(_path); - vgDestroyPaint(_paint); + if( !_vg_initialized ) + { + if( _path != VG_INVALID_HANDLE ) + SG_LOG + ( + SG_GL, + SG_WARN, + "Can't destroy path without OpenVG context: " + << _path_element->_node->getPath() + ); + return; + } + + if( _path != VG_INVALID_HANDLE ) + vgDestroyPath(_path); + if( _paint != VG_INVALID_HANDLE ) + vgDestroyPaint(_paint); + if( _paint_fill != VG_INVALID_HANDLE ) + vgDestroyPaint(_paint_fill); } virtual const char* className() const { return "PathDrawable"; } -- 2.39.5