- fixed infinite recursion when loading logoed studs

Thu, 04 Sep 2014 11:48:05 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Thu, 04 Sep 2014 11:48:05 +0300
changeset 877
7c50b61ad5b6
parent 876
f040f0fb3795
child 878
945e44575b3e

- fixed infinite recursion when loading logoed studs

src/ldDocument.cc file | annotate | diff | comparison | revisions
--- a/src/ldDocument.cc	Wed Sep 03 01:44:51 2014 +0300
+++ b/src/ldDocument.cc	Thu Sep 04 11:48:05 2014 +0300
@@ -46,6 +46,7 @@
 static QList<LDDocumentWeakPtr> g_allDocuments;
 static QList<LDDocumentPtr> g_explicitDocuments;
 static LDDocumentPtr g_currentDocument;
+static bool g_loadingLogoedStuds = false;
 
 const QStringList g_specialSubdirectories ({ "s", "48", "8" });
 
@@ -1461,13 +1462,14 @@
 //
 void LoadLogoStuds()
 {
-	if (g_logoedStud and g_logoedStud2)
+	if (g_loadingLogoedStuds or (g_logoedStud and g_logoedStud2))
 		return;
 
+	g_loadingLogoedStuds = true;
 	g_logoedStud = OpenDocument ("stud-logo.dat", true, true);
 	g_logoedStud2 = OpenDocument ("stud2-logo.dat", true, true);
-
 	print (LDDocument::tr ("Logoed studs loaded.\n"));
+	g_loadingLogoedStuds = false;
 }
 
 // =============================================================================

mercurial