![]() |
|
FTGL crash when exiting program - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Graphics & Audio Programming (/forum-9.html) +--- Thread: FTGL crash when exiting program (/thread-2702.html) |
FTGL crash when exiting program - Malarkey - Mar 26, 2008 05:33 PM Has anyone experienced crashes when exiting an app using FTGL? I'm running this under 10.5 with a slightly tweaked version of the source so that it compiles on 10.5 and all I'm doing is creating a font and rendering some text. It's driving me rather batty I'm about set to figure out how to just use FreeType directly.
FTGL crash when exiting program - OneSadCookie - Mar 26, 2008 06:56 PM The chance anyone can tell you anything without a) a description of the modifications you made to the source, and b) a crash log, is minimal. Even if you have the original author sitting 2m to your right. Which I do. FTGL crash when exiting program - Malarkey - Mar 26, 2008 09:04 PM Doh! Oh yeah, huh. Sorry, I've been spending way too much time trying to figure this out. Anyway, the tweak I made was to line 9 of FTVectoriser.cpp. The original line was: typedef GLvoid (*GLUTesselatorFunction)(...); which caused compile errors under Leopard so I changed it to: typedef GLvoid (*GLUTesselatorFunction)(); As for the crash, as far as I can tell, FreeType seems to die as FTGL tears it down. I've managed to get the FTGL demo up and running but there's no crashes there. This is the relevant bit from the crash log: Code: Exception Type: EXC_BAD_ACCESS (SIGBUS)At this point, all I'm doing is creating a new instance of a FTGLTextureFont object and then quitting the application. I guess next on my list of things to do is check the FTGL source code and see what it's doing with the FreeType library and create a standalone project that basically consists of creating a FTGLTextureFont and make sure it's not my OpenGL code. FTGL crash when exiting program - OneSadCookie - Mar 27, 2008 12:37 AM Well, you've got a global by-value FTLibrary object, and you're crashing in its destructor. That suggests that something that it uses has already been destroyed earlier in the shutdown process. C++ static constructors and destructors are a bitch, and very, very rarely worth the trouble. I'd recommend you make that global a pointer, new it at the appropriate moment at startup, and never delete it
FTGL crash when exiting program - FlamingHairball - Mar 27, 2008 07:01 AM OneSadCookie Wrote:The chance anyone can tell you anything without a) a description of the modifications you made to the source, and b) a crash log, is minimal. Even if you have the original author sitting 2m to your right. Which I do. H-how did you manage that?
FTGL crash when exiting program - AndyKorth - Mar 27, 2008 08:41 AM Hairball183 Wrote:H-how did you manage that? Even programmers have to sit somewhere! Maybe there was no other seat left on the bus except for the one next to OSC. ![]() ;D FTGL crash when exiting program - Malarkey - Mar 27, 2008 11:52 AM OneSadCookie Wrote:Well, you've got a global by-value FTLibrary object, and you're crashing in its destructor. That suggests that something that it uses has already been destroyed earlier in the shutdown process. C++ static constructors and destructors are a bitch, and very, very rarely worth the trouble. Probably not a bad idea at this point. Wouldn't that leak memory, though? ;p So as an experiment, I created a test project that incorporates FTGL and just creating a new instance of a FTGLTextureFont object and then immediately deleting it causes a crash. So I guess once I create an FTFont object, I should never delete it??? That seems rather broken to me.
FTGL crash when exiting program - OneSadCookie - Mar 27, 2008 02:32 PM Malarkey Wrote:Probably not a bad idea at this point. Wouldn't that leak memory, though? ;p I was assuming this object gets created once at startup and destroyed (currently) at shutdown... is that not the case? FTGL crash when exiting program - Malarkey - Mar 27, 2008 03:33 PM OneSadCookie Wrote:I was assuming this object gets created once at startup and destroyed (currently) at shutdown... is that not the case? Sorry, I should've been more clear. The global by-value FTLibrary object is in the FTGL source code. It's not something I create and destroy. The only thing I'm creating is a FTGLTextureFont object which (I think) causes an instance of FTLibrary to be created via a singleton design pattern. So literally, having Code: FTGLTextureFont* font; causes my app to crash when I'm quitting so I'm rather perplexed by this. In fact, after further experimentation with a test project, where FTGL will crash and the kind of code that will crash it is rather inconsistent. So as I mentioned earlier, I created a test project that all it does is create an instance of FTGLTextureFont. Quitting the app without deleting this object produces no crash on exit. However, immediately deleting the object does cause a crash. The other thing I discovered is that by calling FTLibrary::Instance to set up the FTLibrary singleton, I can't do much else since calling simple functions like FaceSize() causes a crash. I also did some Google searches for "FTGL Leopard" but didn't come up with anything useful. Maybe I should install 10.4 on an external drive and build the FTGL libraries there. I think from my original post, I was just looking for people running 10.5 that are using FTGL and if any were found, if they had any problems with it.
|