查看单个帖子
旧 2009-05-06, 09:13 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】oduninitialize90 in mfc crash

oduninitialize() in mfc crash
oduninitialize() in mfc crash
simple mfc application in msvc8.0 keeps crashing after oduninitialize() command.
wout this one an memory leaks detected. ddwg v.2.0.3.
debugging shows this happening inside refcountertype operator -- () when srvcs is going out of scope (after oduninitialize() command).
commenting out oduninitialize() is giving memory leak on app exit.
could somebody help, please, to figure out what other object cleaning i'm missing.
fragment seats on clickbutton event and is odcopyex example analog:
code:
class myservices : public exsystemservices, public exhostappservices
{
protected:
odrx_using_heap_operators(exsystemservices);
};
// caboutdlg dialog used for app about
void cddtestdlg:nbnclickedbuttonempty()
{
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
oddbdatabaseptr pdb = svcs.createdatabase(); // all default values
odstring outfile("c:\\dummy.dwg");
odrxobjectimpl<odwrfilebuf> fb;
fb.open(outfile.c_str());
pdb->writefile(&fb, oddb::kdwg, oddb::vac15, false /* generate bitmap */);
oduninitialize();
}
life would be so much easier if we could just look at the source codefff">fff">
last edited by gok; 2nd october 2006 at 07:39 pmfff">.
destroy database before calling oduninitialize();
vladimir
not sure how to do that (isnt it a job for smart pointer?),
pdb->release() is giving the same error message.
with odamfcapp style i moved oduninitialize() down to dlg destroy stage and it works this way:
code:
void cddtestdlg:ndestroy()
{
cdialog:ndestroy();
:duninitialize();
}
life would be so much easier if we could just look at the source codefff">fff">
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)