Removed the exiting hacks

Sun, 06 Sep 2015 13:46:39 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 06 Sep 2015 13:46:39 +0300
changeset 987
91281e39c50c
parent 986
525921eae58c
child 988
ac4a2ae54f76

Removed the exiting hacks

src/dialogs/ldrawpathdialog.cpp file | annotate | diff | comparison | revisions
src/dialogs/ldrawpathdialog.h file | annotate | diff | comparison | revisions
src/ldObject.cpp file | annotate | diff | comparison | revisions
src/ldpaths.cpp file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/toolsets/filetoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/dialogs/ldrawpathdialog.cpp	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/dialogs/ldrawpathdialog.cpp	Sun Sep 06 13:46:39 2015 +0300
@@ -43,7 +43,7 @@
 
 	connect (ui.path, SIGNAL (textChanged (QString)), this, SIGNAL (pathChanged (QString)));
 	connect (ui.searchButton, SIGNAL (clicked()), this, SLOT (searchButtonClicked()));
-	connect (ui.buttonBox, SIGNAL (rejected()), this, validDefault ? SLOT (reject()) : SLOT (slot_exit()));
+	connect (ui.buttonBox, SIGNAL (rejected()), this, SLOT (reject()));
 	connect (ui.buttonBox, SIGNAL (accepted()), this, SLOT (accept()));
 	setPath (defaultPath);
 }
@@ -81,11 +81,6 @@
 		setPath (newpath);
 }
 
-void LDrawPathDialog::slot_exit()
-{
-	Exit();
-}
-
 void LDrawPathDialog::setStatusText (const QString& statusText, bool ok)
 {
 	okButton()->setEnabled (ok);
--- a/src/dialogs/ldrawpathdialog.h	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/dialogs/ldrawpathdialog.h	Sun Sep 06 13:46:39 2015 +0300
@@ -42,5 +42,4 @@
 
 private slots:
 	void searchButtonClicked();
-	void slot_exit();
-};
+};
\ No newline at end of file
--- a/src/ldObject.cpp	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/ldObject.cpp	Sun Sep 06 13:46:39 2015 +0300
@@ -78,8 +78,8 @@
 
 LDObject::~LDObject()
 {
-	if (not IsExiting() and not m_isDestroyed)
-		print ("Warning: Object #%1 was not destroyed before getting deleted\n", id());
+	if (not m_isDestroyed)
+		print ("Warning: Object #%1 (%2) was not destroyed before being deleted\n", id(), this);
 }
 
 // =============================================================================
@@ -293,26 +293,20 @@
 //
 void LDObject::destroy()
 {
-	// Don't bother during program termination (FIXME)
-	if (IsExiting() == false)
-	{
-		deselect();
+	deselect();
 
-		// If this object was associated to a file, remove it off it now
-		if (document())
-			document()->forgetObject (this);
+	// If this object was associated to a file, remove it off it now
+	if (document())
+		document()->forgetObject (this);
 
-		// Delete the GL lists
-		if (g_win)
-			g_win->renderer()->forgetObject (this);
+	// Delete the GL lists
+	if (g_win)
+		g_win->renderer()->forgetObject (this);
 
-		// Remove this object from the list of LDObjects
-		g_allObjects.erase (g_allObjects.find (id()));
+	// Remove this object from the list of LDObjects
+	g_allObjects.erase (g_allObjects.find (id()));
 
-		m_isDestroyed = true;
-	}
-
-	delete this;
+	m_isDestroyed = true;
 }
 
 // =============================================================================
--- a/src/ldpaths.cpp	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/ldpaths.cpp	Sun Sep 06 13:46:39 2015 +0300
@@ -20,7 +20,7 @@
 		connect (m_dialog, SIGNAL (pathChanged(QString)), this, SLOT (configurePaths (QString)));
 
 		if (not m_dialog->exec())
-			Exit();
+			exit (1);
 		else
 			m_config->setLDrawPath (m_dialog->path());
 	}
--- a/src/main.cpp	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/main.cpp	Sun Sep 06 13:46:39 2015 +0300
@@ -34,9 +34,6 @@
 #include "ldpaths.h"
 
 MainWindow* g_win = nullptr;
-static QString g_versionString, g_fullVersionString;
-static bool g_IsExiting (false);
-
 const Vertex Origin (0.0f, 0.0f, 0.0f);
 const Matrix IdentityMatrix ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
 
@@ -62,18 +59,5 @@
 	for (int arg = 1; arg < argc; ++arg)
 		OpenMainModel (QString::fromLocal8Bit (argv[arg]));
 
-	int result = app.exec();
-	g_IsExiting = true;
-	return result;
-}
-
-bool IsExiting()
-{
-	return g_IsExiting;
-}
-
-void Exit()
-{
-	g_IsExiting = true;
-	exit (EXIT_SUCCESS);
-}
+	return app.exec();
+}
\ No newline at end of file
--- a/src/main.h	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/main.h	Sun Sep 06 13:46:39 2015 +0300
@@ -31,6 +31,3 @@
 #include "version.h"
 #include "format.h"
 #include "hierarchyelement.h"
-
-bool IsExiting();
-void Exit();
--- a/src/toolsets/filetoolset.cpp	Sun Sep 06 04:48:58 2015 +0300
+++ b/src/toolsets/filetoolset.cpp	Sun Sep 06 13:46:39 2015 +0300
@@ -107,7 +107,7 @@
 
 void FileToolset::exit()
 {
-	Exit();
+	::exit (EXIT_SUCCESS);
 }
 
 void FileToolset::insertFrom()

mercurial