mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 01:32:05 +05:00
Workaround of BUG OCC13051
This commit is contained in:
parent
0375941382
commit
ddeda33663
@ -32,6 +32,8 @@
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#include <windows.h>
|
||||
#else
|
||||
@ -54,6 +56,37 @@ typedef TopoDS_Shape (*funcPoint)(const TCollection_AsciiString&,
|
||||
const TCollection_AsciiString&,
|
||||
TCollection_AsciiString&);
|
||||
|
||||
//This class is workaround of BUG OCC13051
|
||||
//It's stored all loaded libraries for import and unload that in destructor
|
||||
class DLL_Collector
|
||||
{
|
||||
typedef NCollection_DataMap<TCollection_AsciiString,LibHandle> DLL_Collector_Map;
|
||||
DLL_Collector_Map myMapOfDLL;
|
||||
public:
|
||||
DLL_Collector(){};
|
||||
~DLL_Collector()
|
||||
{
|
||||
DLL_Collector_Map::Iterator Iter( myMapOfDLL );
|
||||
for( ; Iter.More(); Iter.Next() )
|
||||
UnLoadLib( Iter.Value() );
|
||||
}
|
||||
|
||||
public:
|
||||
LibHandle LoadDLL( const TCollection_AsciiString& theLibName )
|
||||
{
|
||||
if ( myMapOfDLL.IsBound( theLibName ) )
|
||||
return myMapOfDLL( theLibName );
|
||||
|
||||
LibHandle res = LoadLib( theLibName.ToCString() );
|
||||
if ( res )
|
||||
myMapOfDLL.Bind( theLibName, res );
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
static DLL_Collector GlobalCollector;
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
@ -92,8 +125,8 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
|
||||
if (aFileName.IsEmpty() || aFormatName.IsEmpty() || aLibName.IsEmpty())
|
||||
return 0;
|
||||
|
||||
// load plugin library
|
||||
LibHandle anImportLib = LoadLib( aLibName.ToCString() );
|
||||
// load plugin library
|
||||
LibHandle anImportLib = GlobalCollector.LoadDLL( aLibName ); //This is workaround of BUG OCC13051
|
||||
funcPoint fp = 0;
|
||||
if ( anImportLib )
|
||||
fp = (funcPoint)GetProc( anImportLib, "Import" );
|
||||
@ -105,8 +138,8 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
|
||||
TCollection_AsciiString anError;
|
||||
TopoDS_Shape aShape = fp( aFileName, aFormatName, anError );
|
||||
|
||||
// unload plugin library
|
||||
UnLoadLib( anImportLib );
|
||||
// unload plugin library
|
||||
//UnLoadLib( anImportLib ); //This is workaround of BUG OCC13051
|
||||
|
||||
if ( aShape.IsNull() ) {
|
||||
StdFail_NotDone::Raise(anError.ToCString());
|
||||
|
Loading…
x
Reference in New Issue
Block a user