76 LDOBJ_DEFAULT_CTOR (LDBFC, LDObject) |
77 LDOBJ_DEFAULT_CTOR (LDBFC, LDObject) |
77 LDOBJ_DEFAULT_CTOR (LDComment, LDObject) |
78 LDOBJ_DEFAULT_CTOR (LDComment, LDObject) |
78 |
79 |
79 LDObject::~LDObject() |
80 LDObject::~LDObject() |
80 { |
81 { |
81 // Don't bother during program termination |
82 if (not IsExiting() and not m_isDestroyed) |
82 if (IsExiting() == false) |
83 print ("Warning: Object #%1 was not destroyed before getting deleted\n", id()); |
83 { |
|
84 deselect(); |
|
85 |
|
86 // If this object was associated to a file, remove it off it now |
|
87 if (document() != null) |
|
88 document()->forgetObject (this); |
|
89 |
|
90 // Delete the GL lists |
|
91 if (g_win != null) |
|
92 g_win->R()->forgetObject (this); |
|
93 |
|
94 // Remove this object from the list of LDObjects |
|
95 g_allObjects.erase (g_allObjects.find (id())); |
|
96 } |
|
97 } |
84 } |
98 |
85 |
99 // ============================================================================= |
86 // ============================================================================= |
100 // |
87 // |
101 void LDObject::chooseID() |
88 void LDObject::chooseID() |
312 |
299 |
313 // ============================================================================= |
300 // ============================================================================= |
314 // |
301 // |
315 void LDObject::destroy() |
302 void LDObject::destroy() |
316 { |
303 { |
|
304 // Don't bother during program termination (FIXME) |
|
305 if (IsExiting() == false) |
|
306 { |
|
307 deselect(); |
|
308 |
|
309 // If this object was associated to a file, remove it off it now |
|
310 if (document() != null) |
|
311 document()->forgetObject (this); |
|
312 |
|
313 // Delete the GL lists |
|
314 if (g_win != null) |
|
315 g_win->R()->forgetObject (this); |
|
316 |
|
317 // Remove this object from the list of LDObjects |
|
318 g_allObjects.erase (g_allObjects.find (id())); |
|
319 |
|
320 m_isDestroyed = true; |
|
321 } |
|
322 |
317 delete this; |
323 delete this; |
318 } |
324 } |
319 |
325 |
320 // ============================================================================= |
326 // ============================================================================= |
321 // |
327 // |