From 010a44f8311f73042fdf45abecdf09aeacc798d3 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 30 Mar 2006 14:13:22 +0000 Subject: [PATCH] protect ssg pointers to avoid occasional crashes (of course it would be nicer if the Occluder would always get removed before its model branch, but that's not easily enforcable) --- simgear/scene/model/shadowvolume.hxx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/simgear/scene/model/shadowvolume.hxx b/simgear/scene/model/shadowvolume.hxx index bd941ce5..ee4b31af 100644 --- a/simgear/scene/model/shadowvolume.hxx +++ b/simgear/scene/model/shadowvolume.hxx @@ -23,6 +23,7 @@ #ifndef _SHADOWVOLUME_HXX #define _SHADOWVOLUME_HXX +#include #include #include @@ -72,10 +73,10 @@ private: bool isFacingLight; } triData; - ssgBranch *geometry_leaf; - ssgBranch *scenery_object; - ssgBranch *lib_object; - ssgBranch *first_select; + ssgSharedPtr geometry_leaf; + ssgSharedPtr scenery_object; + ssgSharedPtr lib_object; + ssgSharedPtr first_select; sgVec3 last_lightpos; sgMat4 last_transform; int frameNumber; @@ -110,14 +111,14 @@ private: void computeShadows(void); void traverseTree(ssgBranch *branch); void find_trans(void); - ssgBranch *scenery_object; - ssgBranch *lib_object; - ssgBranch *pending_object; - ssgBranch *tile; + ssgSharedPtr scenery_object; + ssgSharedPtr lib_object; + ssgSharedPtr pending_object; + ssgSharedPtr tile; ShadowCaster_list parts; OccluderType occluder_type; }; - typedef map SceneryObject_map; + typedef map, SceneryObject *> SceneryObject_map; private: @@ -138,7 +139,7 @@ private: sgMat4 CameraViewM; double sun_angle; SceneryObject_map sceneryObjects; - ssgBranch *ssg_root; + ssgSharedPtr ssg_root; bool shadows_rendered; };