[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bzflag-commits
Subject:    SF.net SVN: bzflag:[19548] trunk/bzflag
From:       brlcad () users ! sourceforge ! net
Date:       2009-03-29 22:38:16
Message-ID: E1Lo3dv-0003Uk-WF () d5vjzd1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 19548
          http://bzflag.svn.sourceforge.net/bzflag/?rev=19548&view=rev
Author:   brlcad
Date:     2009-03-29 22:38:15 +0000 (Sun, 29 Mar 2009)

Log Message:
-----------
Fix a crash-on-exit bug that has been around for quite some time now, thanks to the \
efforts of Mathew Eis (Bulldozer) for tracking down the problem.  The problem was a \
deletion order issue where our FontManager singleton was getting destructed _after_ a \
FTGL FTLibrary static destructor, the latter of which would destroy the freetype \
library and invalidate our references.  this fix avoids the problem by explicitly \
deleting our FontManager before shutdown so we delete our FTFace resources before \
freetype disappears on us.  Another option bulldozer is looking to ammend is having \
FTGL keep track of the FTFonts that are handed out and manually delete them so our \
references to them should have zero'd FT_Font pointers and destruct crash-free \
regardless of ordering.

Modified Paths:
--------------
    trunk/bzflag/AUTHORS
    trunk/bzflag/include/FontManager.h
    trunk/bzflag/src/3D/FontManager.cxx
    trunk/bzflag/src/bzflag/bzflag.cxx

Modified: trunk/bzflag/AUTHORS
===================================================================
--- trunk/bzflag/AUTHORS	2009-03-29 22:24:09 UTC (rev 19547)
+++ trunk/bzflag/AUTHORS	2009-03-29 22:38:15 UTC (rev 19548)
@@ -198,7 +198,10 @@
 Paul Blokus (Paul_PL)
 Eric M. McIntyre (mcintyem)
 Alexander Law
+-- 2009 --
+Mathew Eis (Bulldozer)
 
+
 GOOGLE SUMMER OF CODE
 --------------------------
 
@@ -219,6 +222,7 @@
 Harrison Reiser (bugQ)
 Istvan Szakats (Wyk3d)
 
+
 SERVERS AND INFRASTRUCTURE
 --------------------------
 

Modified: trunk/bzflag/include/FontManager.h
===================================================================
--- trunk/bzflag/include/FontManager.h	2009-03-29 22:24:09 UTC (rev 19547)
+++ trunk/bzflag/include/FontManager.h	2009-03-29 22:38:15 UTC (rev 19548)
@@ -138,6 +138,11 @@
 
   bool freeFontFile(const std::string& fileName);
 
+  /**
+   * destroy all the fonts, clear all the lists
+   */
+  void clear();
+
 protected:
 
   friend class Singleton<FontManager>;
@@ -148,11 +153,6 @@
   void getPulseColor(const GLfloat* color, GLfloat* pulseColor) const;
 
   /**
-   * destroy all the fonts, clear all the lists
-   */
-  void clear();
-
-  /**
    * returns the number of fonts loaded
    */
   int getNumFaces(void);

Modified: trunk/bzflag/src/3D/FontManager.cxx
===================================================================
--- trunk/bzflag/src/3D/FontManager.cxx	2009-03-29 22:24:09 UTC (rev 19547)
+++ trunk/bzflag/src/3D/FontManager.cxx	2009-03-29 22:38:15 UTC (rev 19548)
@@ -242,7 +242,6 @@
 
 FontManager::~FontManager()
 {
-  // FIXME:  boom, this is still problematic
   clear();
   OpenGLGState::unregisterContextInitializer(freeContext, initContext, (void*)this);
 }
@@ -323,13 +322,6 @@
   std::for_each(fontFaces.begin(), fontFaces.end(),
 		std::mem_fun_ref(&BZFontFace_impl::clear) );
 
-  // NOTE: this function doesn't clear out all of the fonts,
-  //       it frees the memory for the used face sizes
-  //
-  // name2id.clear();
-  // file2id.clear();
-  //
-
   return;
 }
 

Modified: trunk/bzflag/src/bzflag/bzflag.cxx
===================================================================
--- trunk/bzflag/src/bzflag/bzflag.cxx	2009-03-29 22:24:09 UTC (rev 19547)
+++ trunk/bzflag/src/bzflag/bzflag.cxx	2009-03-29 22:38:15 UTC (rev 19548)
@@ -1392,6 +1392,7 @@
   delete platformFactory;
   delete bm;
   Flags::kill();
+  FontManager::instance().clear();
 
 #if defined(_WIN32)
   {


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
BZFlag-commits mailing list
BZFlag-commits@lists.SourceForge.net
https://lists.SourceForge.net/lists/listinfo/bzflag-commits
irc: #BZFlag @ irc.freenode.net


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic