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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-04, 03:29 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】access violation at program exi

access violation at program exit
access violation at program exit
i'm using dwgdirect 1.14.01 with borland c++ builder 6.0 and have tried to get the included sample programs to run properly. they seem to function properly, but always cause and access violation at program end due to some smart pointer trying to free something that was already freed before (smartptr.h: 261). i've tried around with compiler settings but didn't manage to get rid of that error.
a minimal sample program is attached. the error occurs at "return 0" when all leftover objects are freed.
is borland c++ builder still supported or should i think of switching to visual studio? i just don't want to deal with the mfc.
attached files
i have experienced a similar problem using borland builder but it i believe the same issue exists in mfc. this was documented in the group discussion somewhere previously. try searching for the solution in the group discussions.
solution was to assign null to the drawing database pointer before exiting. ie. dwgpointer = null;
maybe someone else can detail further.
hope this helps.
not using any db
thanks for the prompt reply. i guess you were referring to the thread at right?
the problem here is that in the small project i've attached in my original post, i'm not creating any databases. the code of the main() function is
code:
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
oduninitialize();
additionally, oduninitialize() is not the function to cause the error. the access violation occurs after that, when all objects go out of scope. neither is it only a problem of my sample program, as odreadex and odcopyex cause the same error. i guess it must be something in my compilation settings.
more info
after doing some step-though debugging, i can pinpoint the error location to exhostappservices or some parent of it, that on construction creates an odhatchpatternmanager, and on destruction first frees that odhatchpatternmanager and then tries to free an instance of odpwdcache, which was never instantiated. that instance is pointed to by m_ppwdcache from dbhostappservices. i've tried detaching m_ppwdcache on construction of exhostappservices, which causes the program to fail when trying to free and instance of dbplotsettingsvalidator, pointed to by m_pvalidator of dbhostappservices. detaching that as well on construction makes the program fail after freeing m_pvalidator, but i stopped tracing at that point because i guess that the reason's somewhere else. any ideas what might go wrong there?
i've found the solution: "treat enum types as ints" has to be set for it to work.
quote:
originally posted by jdrugo
i've found the solution: "treat enum types as ints" has to be set for it to work.
you are absolutely right! it's mentioned in faq section.
misha kuzinets
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 02:03 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多