From ff32ef773b19a6d0f7826c7edf7962e2fde492e6 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 29 Nov 2011 23:53:28 -0800
Subject: [PATCH] fix for crash on startup (font system not initialized when
 first creating fonts)

---
 indra/llrender/llfontfreetype.cpp | 7 +++++--
 indra/newview/llviewerwindow.cpp  | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 91c8a37022a..66d4ad2d87d 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -55,7 +55,10 @@ FT_Library gFTLibrary = NULL;
 //static
 void LLFontManager::initClass()
 {
-	gFontManagerp = new LLFontManager;
+	if (!gFontManagerp) 
+	{
+		gFontManagerp = new LLFontManager;
+	}
 }
 
 //static
@@ -136,7 +139,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v
 		FT_Done_Face(mFTFace);
 		mFTFace = NULL;
 	}
-
+	
 	int error;
 
 	error = FT_New_Face( gFTLibrary,
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 2479006eeb7..22076417a64 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -4745,6 +4745,9 @@ void LLViewerWindow::initFonts(F32 zoom_factor)
 {
 	LLFontGL::destroyAllGL();
 	// Initialize with possibly different zoom factor
+
+	LLFontManager::initClass();
+
 	LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
 								mDisplayScale.mV[VX] * zoom_factor,
 								mDisplayScale.mV[VY] * zoom_factor,
-- 
GitLab