W
William F. Kinsley
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::GCAboutDlg *dlg;
dlg = __gc new MFCTestApp::GCAboutDlg ();
#pragma pop_macro("new")
dlg->ShowDialog();
delete dlg;
}
-- Call Stack
-- -------------------------------------------+
mfc71d.dll!COleMessageFilter::`scalar deleting destructor'() + 0xf C++
mfc71d.dll!AfxOleTerm(int bJustRevoke=0) Line 114 + 0x22 C++
mfc71d.dll!AfxOleTermOrFreeLib(int bTerm=1, int bJustRevoke=0) Line 139
C++
mfc71d.dll!AfxWinTerm() Line 48 C++
mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, char * lpCmdLine=0x00141f2f, int nCmdShow=5) Line
64 C++
MFCTestApp.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, char * lpCmdLine=0x00141f2f, int nCmdShow=5) Line
25 C++
MFCTestApp.exe!WinMainCRTStartup() Line 390 + 0x39 C
00e1a09f()
mscorwks.dll!CoInitializeCor() + 0xbe77
mscorwks.dll!CoInitializeCor() + 0xbb94
mscorwks.dll!CoInitializeCor() + 0xbcea
mscorwks.dll!CoInitializeCor() + 0xbd56
mscorwks.dll!CoEEShutDownCOM() + 0x2105
mscorwks.dll!DllGetClassObjectInternal() + 0x65ef
mscorwks.dll!DllGetClassObjectInternal() + 0x66ee
mscorwks.dll!DllGetClassObjectInternal() + 0x6bdc
mscorwks.dll!_CorDllMain() + 0x1f0
mscorwks.dll!_CorExeMain() + 0x47
kernel32.dll!_BaseProcessStart@4() + 0x23
-- MFC Source that is asserting
-- NOTE m_dwRef = 2
-- -------------------------------------------+
CCmdTarget::~CCmdTarget()
{
#ifndef _AFX_NO_OLE_SUPPORT
if (m_xDispatch.m_vtbl != 0)
((COleDispatchImpl*)&m_xDispatch)->Disconnect();
ASSERT(m_dwRef <= 1);
#endif
#ifdef _AFXDLL
m_pModuleState = NULL;
#endif
}
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::GCAboutDlg *dlg;
dlg = __gc new MFCTestApp::GCAboutDlg ();
#pragma pop_macro("new")
dlg->ShowDialog();
delete dlg;
}
-- Call Stack
-- -------------------------------------------+
mfc71d.dll!COleMessageFilter::~COleMessageFilter() Line 59 + 0xf C++mfc71d.dll!CCmdTarget::~CCmdTarget() Line 48 + 0x19 C++
mfc71d.dll!COleMessageFilter::`scalar deleting destructor'() + 0xf C++
mfc71d.dll!AfxOleTerm(int bJustRevoke=0) Line 114 + 0x22 C++
mfc71d.dll!AfxOleTermOrFreeLib(int bTerm=1, int bJustRevoke=0) Line 139
C++
mfc71d.dll!AfxWinTerm() Line 48 C++
mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, char * lpCmdLine=0x00141f2f, int nCmdShow=5) Line
64 C++
MFCTestApp.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, char * lpCmdLine=0x00141f2f, int nCmdShow=5) Line
25 C++
MFCTestApp.exe!WinMainCRTStartup() Line 390 + 0x39 C
00e1a09f()
mscorwks.dll!CoInitializeCor() + 0xbe77
mscorwks.dll!CoInitializeCor() + 0xbb94
mscorwks.dll!CoInitializeCor() + 0xbcea
mscorwks.dll!CoInitializeCor() + 0xbd56
mscorwks.dll!CoEEShutDownCOM() + 0x2105
mscorwks.dll!DllGetClassObjectInternal() + 0x65ef
mscorwks.dll!DllGetClassObjectInternal() + 0x66ee
mscorwks.dll!DllGetClassObjectInternal() + 0x6bdc
mscorwks.dll!_CorDllMain() + 0x1f0
mscorwks.dll!_CorExeMain() + 0x47
kernel32.dll!_BaseProcessStart@4() + 0x23
-- MFC Source that is asserting
-- NOTE m_dwRef = 2
-- -------------------------------------------+
CCmdTarget::~CCmdTarget()
{
#ifndef _AFX_NO_OLE_SUPPORT
if (m_xDispatch.m_vtbl != 0)
((COleDispatchImpl*)&m_xDispatch)->Disconnect();
ASSERT(m_dwRef <= 1);
#endif
#ifdef _AFXDLL
m_pModuleState = NULL;
#endif
}