[osg-users] OSG 2.1.10 crash in osgText / osgdb_freetyped

Cedric Pinson mornifle at plopbyte.net
Sat Sep 15 09:44:28 PDT 2007


I dont know if it's related but i have found a deadlock 
osgText::findFontFile.
here the code that lock:
osgText::findFontFile("Vera.ttf");
in fact it locks if it can't find the font.

check for the **** in the source. The function findFontFile call itself 
and because of the lock (in code xxxxxxx)
. It blocks at line (#########)

std::string osgText::findFontFile(const std::string& str)
{
    // try looking in OSGFILEPATH etc first for fonts.
    std::string filename = osgDB::findDataFile(str);
    if (!filename.empty()) return filename;

xxxxxxxx    OpenThreads::ScopedLock<OpenThreads::Mutex> 
lock(s_FontFileMutex);

    static osgDB::FilePathList s_FontFilePath;
    static bool initialized = false;
    if (!initialized)
    {
        initialized = true;
    #if defined(WIN32)
        osgDB::convertStringPathIntoFilePathList(
            ".;C:/winnt/fonts;C:/windows/fonts",
            s_FontFilePath);

        char *ptr;
        if ((ptr = getenv( "windir" )))
        {
            std::string winFontPath = ptr;
            winFontPath += "\\fonts";
            s_FontFilePath.push_back(winFontPath);
        }
    #else
######        osgDB::convertStringPathIntoFilePathList(
            
".:/usr/share/fonts/ttf:/usr/share/fonts/ttf/western:/usr/share/fonts/ttf/decoratives",
            s_FontFilePath);
    #endif
    }

    filename = osgDB::findFileInPath(str,s_FontFilePath);
    if (!filename.empty()) return filename;

    // Try filename without pathname, if it has a path
    filename = osgDB::getSimpleFileName(str);
    if(filename!=str)
    {
        filename = osgDB::findFileInPath(filename,s_FontFilePath);
        if (!filename.empty()) return filename;
    }
    else
    {
*****        filename = 
osgText::findFontFile(std::string("fonts/")+filename);
        if (!filename.empty()) return filename;
    }

    // Not found, return empty string
    osg::notify(osg::WARN)<<"Warning: font file \""<<str<<"\" not 
found."<<std::endl;   
    return std::string();
}

I have the same behaviour on 2.1.9

Cedric


Gert van Maren wrote:
> Hi guys,
>
> Still getting crashes on dual core machines in osg21-osgTextd.dll / 
> osg21-osgd.dll (with 2.1.10 (also 2.1.9)). It seems to do with the 
> osgdb_freetyped.dll because when we disable all osgText in our app -> 
> the osgdb_freetyped.dll does not get loaded hence no crashes. If I 
> disable dual core in the bios, I can have text -> no crashes.
>
> So when running dual core -> still osgText crashes.
>
> below: the 'windows' output for 2 crashes and I have attached a call 
> stack as well.
>
> 'v3_viewerd.exe': Loaded 
> 'D:\OpenSceneGraph-2.1.10\OpenSceneGraph\bin\osgplugins-2.1.10\osgdb_freetyped.dll', 
> Symbols loaded.
> First-chance exception at 0x00cd1161 (osg21-osgTextd.dll) in 
> v3_viewerd.exe: 0xC0000005: Access violation reading location 0x00000000.
> First-chance exception at 0x7c812a5b in v3_viewerd.exe: Microsoft C++ 
> exception: [rethrow] @ 0x00000000.
>
> 'v3_viewerd.exe': Loaded 
> 'D:\OpenSceneGraph-2.1.10\OpenSceneGraph\bin\osgplugins-2.1.10\osgdb_freetyped.dll', 
> Symbols loaded.
> First-chance exception at 0x008b4232 (osg21-osgd.dll) in 
> v3_viewerd.exe: 0xC0000005: Access violation reading location 0x0006ffff.
>
> Hopefully this points to the bug.
>
> Gert
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list