@@ -170,11 +170,9 @@ CW3DViewDoc::CleanupResources (void)
170170
171171 if (m_pCursor != NULL ) {
172172 m_pCursor->Remove ();
173- m_pCursor = NULL ;
174- }
175- if (m_pCursorScene) {
176- m_pCursorScene = NULL ;
177173 }
174+ m_pCursor.Clear ();
175+ m_pCursorScene.Clear ();
178176
179177 if (m_pCScene)
180178 {
@@ -240,14 +238,10 @@ CW3DViewDoc::CleanupResources (void)
240238 m_pCSceneLight = NULL ;
241239 }
242240
243- // Was there a valid display object?
244- if (m_pCRenderObj)
245- {
246- // Free the currently displayed object
247- SAFE_DELETE (m_pCAnimCombo);
248- m_pCAnimation = NULL ;
249- m_pCRenderObj = NULL ;
250- }
241+ // Free the currently displayed object
242+ SAFE_DELETE (m_pCAnimCombo);
243+ m_pCAnimation.Clear ();
244+ m_pCRenderObj.Clear ();
251245
252246 return ;
253247}
@@ -282,13 +276,10 @@ CW3DViewDoc::OnNewDocument (void)
282276 m_pCScene->Set_Fog_Color (m_backgroundColor);
283277 }
284278
285- if (m_pCRenderObj)
286- {
287- // Free the currently displayed object
288- SAFE_DELETE (m_pCAnimCombo);
289- m_pCAnimation = NULL ;
290- m_pCRenderObj = NULL ;
291- }
279+ // Free the currently displayed object
280+ SAFE_DELETE (m_pCAnimCombo);
281+ m_pCAnimation.Clear ();
282+ m_pCRenderObj.Clear ();
292283
293284 CDataTreeView *pCDataTreeView = GetDataTreeView ();
294285 if (pCDataTreeView)
@@ -610,15 +601,15 @@ CW3DViewDoc::Display_Emitter
610601 // Data OK?
611602 if (m_pCScene != NULL ) {
612603
613- // Lose the animation
614- SAFE_DELETE (m_pCAnimCombo);
604+ // Lose the animation
605+ SAFE_DELETE (m_pCAnimCombo);
606+ m_pCAnimation.Clear ();
615607
616608 if (m_pCRenderObj != NULL ) {
617-
618609 // Remove this object from the scene
619610 Remove_Object_From_Scene (m_pCRenderObj.Peek ());
620- m_pCRenderObj = NULL ;
621611 }
612+ m_pCRenderObj.Clear ();
622613 m_pCScene->Clear_Lineup ();
623614
624615 // Do we have a new emitter to display?
@@ -672,12 +663,11 @@ CW3DViewDoc::DisplayObject
672663
673664 // Do we have an old object to remove from the scene?
674665 if (add_ghost == false ) {
675- if (m_pCRenderObj)
676- {
666+ if (m_pCRenderObj) {
677667 // Remove this object from the scene
678668 Remove_Object_From_Scene (m_pCRenderObj.Peek ());
679- m_pCRenderObj = NULL ;
680669 }
670+ m_pCRenderObj.Clear ();
681671 }
682672 m_pCScene->Clear_Lineup ();
683673
0 commit comments