Hi,
 
I noticed that the problem lies in the DLL unloading. The main thread
first unloads freetype dll, causing the memory cleanup and then later
when osgDB unloads it's cache cleanup code tries to free the font as
well causing the crash. 

I fixed my code by adding explicit registry cache cleanup before program
exit:

        osgDB::Registry::instance()->clearObjectCache();

Unfortunately I don't have time to dig deeper for a fix, but hopefully
this helps to pinpoint the problem. Adding  breakpoint in the
FreeTypeLibrary::~FreeTypeLibrary() should catch the problem in
debugger, when using compiled freetype library.

Actually now that I read the documentation in ~FreeTypeLibrary it
actually warns about what happened:

    // need to remove the implementations from the Fonts here
    // just in case the Fonts continue to have external references
    // to them, otherwise they will try to point to an object thats
    // definition has been unloaded along with the unload of the
FreeType
    // plugin.

System used:
 VS 8.0
 OSG 2.3.3 from SVN 7835
 freetype 2.3.5 compiled from source with matching VS project settings
and copied over 3rdparty library.

Regards,

Jari
 
________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian
Egli OpenSceneGraph (3D)
Sent: 2. helmikuuta 2008 12:56
To: OpenSceneGraph Users
Subject: Re: [osg-users] Win32 VS8.0 crash on exit in debugger,related
to freetype


Hi all, 

the problem is (i guess) that freetype is not at all thread safe. my you
can try to test in singlethread mode. if there is no crash, than we
should have a look into the osgText freetype access at clean up. i still
got many crashes in reason of that in other application using freetype
in multi threaded env. 

/regards 


2008/2/2, Antoine Hue <[EMAIL PROTECTED]>: 

        2008/1/24, Jean-Sebastien Guay <[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>:
        >
        >         Hello Robert,
        >
        >         > Its a bit of long shot but I just had a look at the
        >         DeleteHandeler
        >         > code in src/osg/Referenced.cpp and
src/osg/DeleteHandler.cpp and
        >         > noticed a duplicate definition of the
DeleteHandlerPointer
        >         struct, one
        >         > in Referenced.cpp, and one in DeleteHandler.cpp.  I
have
        >         removed the
        >         > duplicate in DeleteHandler.cpp and checked this in.
        >         >
        >         > Could you do an svn update and see if this makes any
difference.
        >
        >         It was a good try, but no cigar... I still get the
same symptoms.
        >
        >         I have the impression the problem is in freetype
itself,
        >         because I get some
        >         freetype functions in the stack trace. Unfortunately I
can't
        >         trace into the
        >         freetype source even though I'm linking to the debug
lib,
        >         which I don't
        >         understand why.
        >
        >         I think I'll backtrack to an older version of freetype
and see
        >         if that helps.
        >         But it'll have to wait till at least next Monday.
        >
        Hello,
        
        It seems this problem is not Windows only.
        I have almost the same symptoms under Linux, Ubuntu Amd64,
application
        crashes on exit and Valgrind mem debugger is reporting some
double
        delete of DynamicLibrary for Free-type. A friend is also
reporting a
        crash under Mac OS X/PPC with Free-type in the stack trace.
        
        I will try to come with a more complete report.
        
        Fact  is I could not reproduce the Linux crash/ Valgrind report
with
        osgSimpleViewerQT. Whose content is very similar to our embedded
viewer.
        I could not find differences in the use of Freetype in our
application !?
        
        Antoine
        _______________________________________________
        osg-users mailing list
        osg-users@lists.openscenegraph.org
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
        




-- 
********************************************
Adrian Egli 
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to