src/ldObject.cc

changeset 857
e62983881460
parent 854
403affd33c6e
child 861
83426c5fa732
--- a/src/ldObject.cc	Mon Jul 28 16:38:34 2014 +0300
+++ b/src/ldObject.cc	Tue Jul 29 13:12:22 2014 +0300
@@ -89,7 +89,7 @@
 	critical ("Created too many objects. Execution cannot continue. You have a "
 		"chance to save any changes to documents, then restart.");
 	(void) safeToCloseAll();
-	exit (0);
+	Exit();
 }
 
 // =============================================================================
@@ -303,6 +303,10 @@
 //
 void LDObject::destroy()
 {
+	// Don't bother during program termination
+	if (IsExiting() or isDestructed())
+		return;
+
 	// If this object was selected, unselect it now
 	if (isSelected())
 		deselect();
@@ -312,7 +316,8 @@
 		document().toStrongRef()->forgetObject (self());
 
 	// Delete the GL lists
-	g_win->R()->forgetObject (self());
+	if (g_win != null)
+		g_win->R()->forgetObject (self());
 
 	// Remove this object from the list of LDObjects
 	g_allObjects.erase (g_allObjects.find (id()));

mercurial