I am thinking of porting an existing MFC application to MC++ and I have
created a simple MFC application to test the environment. My sample MFC
application is compilied with the /clr switch. I added a basic WinForm
class(via the wizard). In my MFC WinApp class I have a menu message handler
to display the standard About Dialog. In the message handler I create, show
and close the window. Everything appears to be working fine until I close
the application and I get an assertion about a COM ref not being released.
Thanks
--
+--------------------------------------+
William F. Kinsley
Sr. Design Engineer
NextGen Healthcare Info. Sys. Inc
// App command to run the dialog
void CMFCTestAppApp: :OnAppAbout()
{
#pragma push_macro("new ")
#undef new
MFCTestApp::GCA boutDlg *dlg;
dlg = __gc new MFCTestApp::GCA boutDlg ();
#pragma pop_macro("new" )
dlg->ShowDialog() ;
delete dlg;
}
-- Call Stack
-- -------------------------------------------+
mfc71d.dll!CCmd Target::~CCmdTa rget() Line 48 + 0x19 C++
mfc71d.dll!COle MessageFilter:: ~COleMessageFil ter() Line 59 + 0xf C++
mfc71d.dll!COle MessageFilter:: `scalar deleting destructor'() + 0xf C++
mfc71d.dll!AfxO leTerm(int bJustRevoke=0) Line 114 + 0x22 C++
mfc71d.dll!AfxO leTermOrFreeLib (int bTerm=1, int bJustRevoke=0) Line 139
C++
mfc71d.dll!AfxW inTerm() Line 48 C++
mfc71d.dll!AfxW inMain(HINSTANC E__ * hInstance=0x004 00000, HINSTANCE__ *
hPrevInstance=0 x00000000, char * lpCmdLine=0x001 41f2f, int nCmdShow=5) Line
64 C++
MFCTestApp.exe! WinMain(HINSTAN CE__ * hInstance=0x004 00000, HINSTANCE__ *
hPrevInstance=0 x00000000, char * lpCmdLine=0x001 41f2f, int nCmdShow=5) Line
25 C++
MFCTestApp.exe! WinMainCRTStart up() Line 390 + 0x39 C
00e1a09f()
mscorwks.dll!Co InitializeCor() + 0xbe77
mscorwks.dll!Co InitializeCor() + 0xbb94
mscorwks.dll!Co InitializeCor() + 0xbcea
mscorwks.dll!Co InitializeCor() + 0xbd56
mscorwks.dll!Co EEShutDownCOM() + 0x2105
mscorwks.dll!Dl lGetClassObject Internal() + 0x65ef
mscorwks.dll!Dl lGetClassObject Internal() + 0x66ee
mscorwks.dll!Dl lGetClassObject Internal() + 0x6bdc
mscorwks.dll!_C orDllMain() + 0x1f0
mscorwks.dll!_C orExeMain() + 0x47
kernel32.dll!_B aseProcessStart @4() + 0x23
-- MFC Source that is asserting
-- NOTE m_dwRef = 2
-- -------------------------------------------+
CCmdTarget::~CC mdTarget()
{
#ifndef _AFX_NO_OLE_SUP PORT
if (m_xDispatch.m_ vtbl != 0)
((COleDispatchI mpl*)&m_xDispat ch)->Disconnect() ;
ASSERT(m_dwRef <= 1);
#endif
#ifdef _AFXDLL
m_pModuleState = NULL;
#endif
}