src/ldObject.cpp

changeset 987
91281e39c50c
parent 985
ed7b31b9f904
child 988
ac4a2ae54f76
equal deleted inserted replaced
986:525921eae58c 987:91281e39c50c
76 LDOBJ_DEFAULT_CTOR (LDBFC, LDObject) 76 LDOBJ_DEFAULT_CTOR (LDBFC, LDObject)
77 LDOBJ_DEFAULT_CTOR (LDComment, LDObject) 77 LDOBJ_DEFAULT_CTOR (LDComment, LDObject)
78 78
79 LDObject::~LDObject() 79 LDObject::~LDObject()
80 { 80 {
81 if (not IsExiting() and not m_isDestroyed) 81 if (not m_isDestroyed)
82 print ("Warning: Object #%1 was not destroyed before getting deleted\n", id()); 82 print ("Warning: Object #%1 (%2) was not destroyed before being deleted\n", id(), this);
83 } 83 }
84 84
85 // ============================================================================= 85 // =============================================================================
86 // 86 //
87 void LDObject::chooseID() 87 void LDObject::chooseID()
291 291
292 // ============================================================================= 292 // =============================================================================
293 // 293 //
294 void LDObject::destroy() 294 void LDObject::destroy()
295 { 295 {
296 // Don't bother during program termination (FIXME) 296 deselect();
297 if (IsExiting() == false) 297
298 { 298 // If this object was associated to a file, remove it off it now
299 deselect(); 299 if (document())
300 300 document()->forgetObject (this);
301 // If this object was associated to a file, remove it off it now 301
302 if (document()) 302 // Delete the GL lists
303 document()->forgetObject (this); 303 if (g_win)
304 304 g_win->renderer()->forgetObject (this);
305 // Delete the GL lists 305
306 if (g_win) 306 // Remove this object from the list of LDObjects
307 g_win->renderer()->forgetObject (this); 307 g_allObjects.erase (g_allObjects.find (id()));
308 308
309 // Remove this object from the list of LDObjects 309 m_isDestroyed = true;
310 g_allObjects.erase (g_allObjects.find (id()));
311
312 m_isDestroyed = true;
313 }
314
315 delete this;
316 } 310 }
317 311
318 // ============================================================================= 312 // =============================================================================
319 // 313 //
320 void LDObject::setDocument (LDDocument* const& a) 314 void LDObject::setDocument (LDDocument* const& a)

mercurial