查看单个帖子
旧 2009-05-04, 06:39 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)