fixed: deleting objects would trigger a crash

Tue, 22 Oct 2013 19:33:41 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 22 Oct 2013 19:33:41 +0300
changeset 528
e38d199ef9aa
parent 527
47c068f2e7e3
child 529
c294b2070185

fixed: deleting objects would trigger a crash

src/crashcatcher.cpp file | annotate | diff | comparison | revisions
src/gui.cpp file | annotate | diff | comparison | revisions
src/ldtypes.cpp file | annotate | diff | comparison | revisions
--- a/src/crashcatcher.cpp	Tue Oct 22 19:28:45 2013 +0300
+++ b/src/crashcatcher.cpp	Tue Oct 22 19:33:41 2013 +0300
@@ -32,7 +32,7 @@
 
 	if (g_crashCatcherActive)
 	{	printf ("caught signal while crash catcher is active!\n");
-		return;
+		exit (149);
 	}
 
 	const pid_t pid = getpid();
--- a/src/gui.cpp	Tue Oct 22 19:28:45 2013 +0300
+++ b/src/gui.cpp	Tue Oct 22 19:33:41 2013 +0300
@@ -258,17 +258,13 @@
 		return 0;
 
 	QList<LDObject*> selCopy = selection();
-	int num = 0;
 
 	// Delete the objects that were being selected
 	for (LDObject* obj : selCopy)
-	{	LDFile::current()->forgetObject (obj);
-		++num;
 		delete obj;
-	}
 
 	refresh();
-	return num;
+	return selCopy.size();
 }
 
 // =============================================================================
--- a/src/ldtypes.cpp	Tue Oct 22 19:28:45 2013 +0300
+++ b/src/ldtypes.cpp	Tue Oct 22 19:33:41 2013 +0300
@@ -268,6 +268,10 @@
 	if (selected())
 		unselect();
 
+	// If this object was associated to a file, remove it off it now
+	if (file())
+		file()->forgetObject (this);
+
 	// Delete the GL lists
 	GL::deleteLists (this);
 

mercurial