Anders Eriksson
2007-06-12 11:00:16 UTC
Hello,
I have a MFC SDI CFormView application and in the View I create a dialog
that I DoModal(); The dialog is created using the Resource Editor, not
dynamically.
In the OnInitDialog() I use this code to get a pointer to the View that is
calling the dialog
CMarkerView *pView = (CMarkerView*)GetParent();
I then use this to change a member variable in the view
pView->m_currMagazine = nMagazine;
Somehow this is wrong! using this code will make me crash in
CPlex::FreeDataChain(), See Call Stack below.
What is wrong and how to I get a pointer to the View?
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may improve my English!
mfc80ud.dll!CPtrList::FreeNode(CPtrList::CNode * pNode=0x003bcad0) Line
123 C++
mfc80ud.dll!CPtrList::RemoveAt(__POSITION * position=0x003bcad0) Line
324 C++
mfc80ud.dll!CFrameWnd::RemoveControlBar(CControlBar * pBar=0x01001304)
Line 875 C++
mfc80ud.dll!CControlBar::OnDestroy() Line 586 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=2, unsigned int wParam=0,
long lParam=0, long * pResult=0x0012e9f4) Line 2028 C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=2, unsigned int
wParam=0, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80ud.dll!CControlBar::WindowProc(unsigned int nMsg=2, unsigned int
wParam=0, long lParam=0) Line 504 + 0x14 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001304, HWND__ *
hWnd=0x00011302, unsigned int nMsg=2, unsigned int wParam=0, long lParam=0)
Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x00011302, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x00011302, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
[Frames below may be incorrect and/or missing, no symbols loaded for
user32.dll]
user32.dll!7e418816()
mfc80ud.dll!CThreadSlotData::GetThreadValue(int nSlot=1471840) Line 265
C++
user32.dll!7e41b4c0()
user32.dll!7e41b50c()
ntdll.dll!7c90eae3()
user32.dll!7e41daf6()
mfc80ud.dll!CWnd::DestroyWindow() Line 993 + 0xd bytes C++
mfc80ud.dll!CControlBar::DestroyWindow() Line 598 C++
mfc80ud.dll!CFrameWnd::DestroyDockBars() Line 1618 C++
mfc80ud.dll!CFrameWnd::OnDestroy() Line 852 C++
Marker.exe!CMainFrame::OnDestroy() Line 126 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=2, unsigned int wParam=0,
long lParam=0, long * pResult=0x0012eec4) Line 2028 C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=2, unsigned int
wParam=0, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=2, unsigned int wParam=0, long lParam=0)
Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
mfc80ud.dll!CThreadSlotData::GetThreadValue(int nSlot=1471840) Line 265
C++
user32.dll!7e41b4c0()
user32.dll!7e41b50c()
ntdll.dll!7c90eae3()
user32.dll!7e41daf6()
mfc80ud.dll!CWnd::DestroyWindow() Line 993 + 0xd bytes C++
mfc80ud.dll!CDocument::OnCloseDocument() Line 744 C++
mfc80ud.dll!CDocTemplate::CloseAllDocuments(int __formal=0) Line 355 C++
mfc80ud.dll!CDocManager::CloseAllDocuments(int bEndSession=0) Line 588
C++
mfc80ud.dll!CWinApp::CloseAllDocuments(int bEndSession=0) Line 90 C++
mfc80ud.dll!CFrameWnd::OnClose() Line 798 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=16, unsigned int
wParam=0, long lParam=0, long * pResult=0x0012f2cc) Line 2028 C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=16, unsigned int
wParam=0, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=16, unsigned int wParam=0, long
lParam=0) Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=16,
unsigned int wParam=0, long lParam=0) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int
nMsg=16, unsigned int wParam=0, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41b4c0()
user32.dll!7e41b50c()
ntdll.dll!7c90eae3()
user32.dll!7e4194be()
user32.dll!7e41b42d()
user32.dll!7e4184fc()
user32.dll!7e41ba0e()
user32.dll!7e4184fc()
user32.dll!7e4185a4()
user32.dll!7e41b3f9()
uxtheme.dll!5ad73c20()
uxtheme.dll!5ad8e300()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad71b3d()
uxtheme.dll!5ad8e2d5()
user32.dll!7e41bb15()
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41c63f()
user32.dll!7e41c665()
mfc80ud.dll!CWnd::DefWindowProcW(unsigned int nMsg=274, unsigned int
wParam=61536, long lParam=3408996) Line 1029 + 0x20 bytes C++
mfc80ud.dll!CWnd::Default() Line 274 C++
mfc80ud.dll!CWnd::OnSysCommand(unsigned int __formal=61536, unsigned int
__formal=61536) Line 460 + 0xf bytes C++
mfc80ud.dll!CFrameWnd::OnSysCommand(unsigned int nID=61536, long
lParam=3408996) Line 1042 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=274, unsigned int
wParam=61536, long lParam=3408996, long * pResult=0x0012f8cc) Line 2056
C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=274, unsigned int
wParam=61536, long lParam=3408996) Line 1741 + 0x20 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=274, unsigned int wParam=61536, long
lParam=3408996) Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=274,
unsigned int wParam=61536, long lParam=3408996) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int
nMsg=274, unsigned int wParam=61536, long lParam=3408996) Line 407 + 0x15
bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41b89b()
user32.dll!7e41b903()
uxtheme.dll!5ad9881f()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad71b3d()
user32.dll!7e41bb15()
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41c63f()
user32.dll!7e41c665()
mfc80ud.dll!CWnd::DefWindowProcW(unsigned int nMsg=161, unsigned int
wParam=20, long lParam=3408996) Line 1029 + 0x20 bytes C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=161, unsigned int
wParam=20, long lParam=3408996) Line 1742 + 0x1c bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=161, unsigned int wParam=20, long
lParam=3408996) Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=161,
unsigned int wParam=20, long lParam=3408996) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int
nMsg=161, unsigned int wParam=20, long lParam=3408996) Line 407 + 0x15
bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e4189cd()
user32.dll!7e418a10()
mfc80ud.dll!AfxInternalPumpMessage() Line 183 C++
mfc80ud.dll!CWinThread::PumpMessage() Line 896 C++
mfc80ud.dll!CWinThread::Run() Line 625 + 0xd bytes C++
mfc80ud.dll!CWinApp::Run() Line 889 C++
mfc80ud.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020f94, int nCmdShow=1)
Line 47 + 0xd bytes C++
Marker.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020f94, int nCmdShow=1)
Line 29 C++
Marker.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
Marker.exe!wWinMainCRTStartup() Line 403 C
kernel32.dll!7c816fd7()
I have a MFC SDI CFormView application and in the View I create a dialog
that I DoModal(); The dialog is created using the Resource Editor, not
dynamically.
In the OnInitDialog() I use this code to get a pointer to the View that is
calling the dialog
CMarkerView *pView = (CMarkerView*)GetParent();
I then use this to change a member variable in the view
pView->m_currMagazine = nMagazine;
Somehow this is wrong! using this code will make me crash in
CPlex::FreeDataChain(), See Call Stack below.
What is wrong and how to I get a pointer to the View?
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may improve my English!
mfc80ud.dll!CPlex::FreeDataChain() Line 42 + 0x3 bytes C++
mfc80ud.dll!CPtrList::RemoveAll() Line 48 C++mfc80ud.dll!CPtrList::FreeNode(CPtrList::CNode * pNode=0x003bcad0) Line
123 C++
mfc80ud.dll!CPtrList::RemoveAt(__POSITION * position=0x003bcad0) Line
324 C++
mfc80ud.dll!CFrameWnd::RemoveControlBar(CControlBar * pBar=0x01001304)
Line 875 C++
mfc80ud.dll!CControlBar::OnDestroy() Line 586 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=2, unsigned int wParam=0,
long lParam=0, long * pResult=0x0012e9f4) Line 2028 C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=2, unsigned int
wParam=0, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80ud.dll!CControlBar::WindowProc(unsigned int nMsg=2, unsigned int
wParam=0, long lParam=0) Line 504 + 0x14 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001304, HWND__ *
hWnd=0x00011302, unsigned int nMsg=2, unsigned int wParam=0, long lParam=0)
Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x00011302, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x00011302, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
[Frames below may be incorrect and/or missing, no symbols loaded for
user32.dll]
user32.dll!7e418816()
mfc80ud.dll!CThreadSlotData::GetThreadValue(int nSlot=1471840) Line 265
C++
user32.dll!7e41b4c0()
user32.dll!7e41b50c()
ntdll.dll!7c90eae3()
user32.dll!7e41daf6()
mfc80ud.dll!CWnd::DestroyWindow() Line 993 + 0xd bytes C++
mfc80ud.dll!CControlBar::DestroyWindow() Line 598 C++
mfc80ud.dll!CFrameWnd::DestroyDockBars() Line 1618 C++
mfc80ud.dll!CFrameWnd::OnDestroy() Line 852 C++
Marker.exe!CMainFrame::OnDestroy() Line 126 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=2, unsigned int wParam=0,
long lParam=0, long * pResult=0x0012eec4) Line 2028 C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=2, unsigned int
wParam=0, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=2, unsigned int wParam=0, long lParam=0)
Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int nMsg=2,
unsigned int wParam=0, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
mfc80ud.dll!CThreadSlotData::GetThreadValue(int nSlot=1471840) Line 265
C++
user32.dll!7e41b4c0()
user32.dll!7e41b50c()
ntdll.dll!7c90eae3()
user32.dll!7e41daf6()
mfc80ud.dll!CWnd::DestroyWindow() Line 993 + 0xd bytes C++
mfc80ud.dll!CDocument::OnCloseDocument() Line 744 C++
mfc80ud.dll!CDocTemplate::CloseAllDocuments(int __formal=0) Line 355 C++
mfc80ud.dll!CDocManager::CloseAllDocuments(int bEndSession=0) Line 588
C++
mfc80ud.dll!CWinApp::CloseAllDocuments(int bEndSession=0) Line 90 C++
mfc80ud.dll!CFrameWnd::OnClose() Line 798 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=16, unsigned int
wParam=0, long lParam=0, long * pResult=0x0012f2cc) Line 2028 C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=16, unsigned int
wParam=0, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=16, unsigned int wParam=0, long
lParam=0) Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=16,
unsigned int wParam=0, long lParam=0) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int
nMsg=16, unsigned int wParam=0, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41b4c0()
user32.dll!7e41b50c()
ntdll.dll!7c90eae3()
user32.dll!7e4194be()
user32.dll!7e41b42d()
user32.dll!7e4184fc()
user32.dll!7e41ba0e()
user32.dll!7e4184fc()
user32.dll!7e4185a4()
user32.dll!7e41b3f9()
uxtheme.dll!5ad73c20()
uxtheme.dll!5ad8e300()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad71b3d()
uxtheme.dll!5ad8e2d5()
user32.dll!7e41bb15()
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41c63f()
user32.dll!7e41c665()
mfc80ud.dll!CWnd::DefWindowProcW(unsigned int nMsg=274, unsigned int
wParam=61536, long lParam=3408996) Line 1029 + 0x20 bytes C++
mfc80ud.dll!CWnd::Default() Line 274 C++
mfc80ud.dll!CWnd::OnSysCommand(unsigned int __formal=61536, unsigned int
__formal=61536) Line 460 + 0xf bytes C++
mfc80ud.dll!CFrameWnd::OnSysCommand(unsigned int nID=61536, long
lParam=3408996) Line 1042 C++
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=274, unsigned int
wParam=61536, long lParam=3408996, long * pResult=0x0012f8cc) Line 2056
C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=274, unsigned int
wParam=61536, long lParam=3408996) Line 1741 + 0x20 bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=274, unsigned int wParam=61536, long
lParam=3408996) Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=274,
unsigned int wParam=61536, long lParam=3408996) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int
nMsg=274, unsigned int wParam=61536, long lParam=3408996) Line 407 + 0x15
bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41b89b()
user32.dll!7e41b903()
uxtheme.dll!5ad9881f()
uxtheme.dll!5ad71ac7()
uxtheme.dll!5ad71b3d()
user32.dll!7e41bb15()
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41c63f()
user32.dll!7e41c665()
mfc80ud.dll!CWnd::DefWindowProcW(unsigned int nMsg=161, unsigned int
wParam=20, long lParam=3408996) Line 1029 + 0x20 bytes C++
mfc80ud.dll!CWnd::WindowProc(unsigned int message=161, unsigned int
wParam=20, long lParam=3408996) Line 1742 + 0x1c bytes C++
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x01001230, HWND__ *
hWnd=0x000112b0, unsigned int nMsg=161, unsigned int wParam=20, long
lParam=3408996) Line 240 + 0x1c bytes C++
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x000112b0, unsigned int nMsg=161,
unsigned int wParam=20, long lParam=3408996) Line 389 C++
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000112b0, unsigned int
nMsg=161, unsigned int wParam=20, long lParam=3408996) Line 407 + 0x15
bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e4189cd()
user32.dll!7e418a10()
mfc80ud.dll!AfxInternalPumpMessage() Line 183 C++
mfc80ud.dll!CWinThread::PumpMessage() Line 896 C++
mfc80ud.dll!CWinThread::Run() Line 625 + 0xd bytes C++
mfc80ud.dll!CWinApp::Run() Line 889 C++
mfc80ud.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020f94, int nCmdShow=1)
Line 47 + 0xd bytes C++
Marker.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ *
hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020f94, int nCmdShow=1)
Line 29 C++
Marker.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
Marker.exe!wWinMainCRTStartup() Line 403 C
kernel32.dll!7c816fd7()