几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】crash with multiple instances of dwgdirec (http://www.dimcax.com/hust/showthread.php?t=15551)

yang686526 2009-05-04 06:39 PM

【转帖】crash with multiple instances of dwgdirec
 
crash with multiple instances of dwgdirect
crash with multiple instances of dwgdirect
i have a com class that uses the dwgdirect libraries to read the drawing file. my class does the following in the constructor and destructor respectively:
code:
myclass::myclass()
{
....
odinitialize(&svcs);
}
myclass::~myclass()
{
....
for (all the maps that are read, pdb)
{
if ( !pdb.isnull() )
{
pdb.release();
// dwgdirect forum says that you need to do this to avoid the
// "pure virtual function call" error
pdb = 0;
}
}
...
oduninitialize();
}
the above code works fine when i use one instance of the class. but with multiple instances of my class, the application crashes after the oduninitialize call for the last instance of myclass (irrespective of the number of instances i have created).
please help - anything wrong with the above code?. has anyone used the dwgdirect library successfully in a scenario, like the one explained above.
thanks,
saroja
dwgdirect does not have a reference counter or something like it to track the number of odinitialize() calls.
odinitialize() / oduninitialize() take care about dwgdirect static data. odunitialize() destroys it making further work with dd impossible.
sergey slezkin


所有的时间均为北京时间。 现在的时间是 07:12 AM.