Show
Ignore:
Timestamp:
11/27/09 13:21:44 (5 years ago)
Author:
robert
Message:

From Chris Denham, "I discovered what seems to be a missing call to FreeLibrary? for osgDB.dll The result of this is that it prevents me from dynamically unloading my DLL (which uses OSG). This is because initialisation of the osg::Registry instance results in a call to GetModuleHandleEx? (to get the filename of the DLL). This call to GetModuleHandleEx? increments the module refcount, but there was no matching call to FreeLibrary? for the returned handle. Unlike the old GetModuleHandle? function, GetModuleHandle? does (by default) increment the refcount.

I have added the missing call to FreeLibrary? in osgDB::FileUtils?., and now my the runtime unload of MY dll is working properly. It has also cured some related problems I was having with memory leak checks being reported.

I have attached a fix to osgDB/FileUtils.cpp based on version 2.9.5 svn revision 10374
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgDB/FileUtils.cpp

    r10818 r10837  
    652652                            "using Win32 API. It will not be searched." << std::endl; 
    653653                    } 
     654                    FreeLibrary(thisModule); 
    654655                } 
    655656                else