By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

System Access Error

P: 3
I have a code in VC++ that gives this particular error on exiting the program while executing in release mode.

Error:
An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module.

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

The execution breaks at one of these places:

1. file name oleinit.cpp
Expand|Select|Wrap|Line Numbers
  1. if (pThread != NULL)
  2.         {
  3.             // destroy message filter (may be derived class)
  4.             delete pThread->m_pMessageFilter;
  5.             pThread->m_pMessageFilter = NULL; // This is the line where execution breaks
  6.         }
2. File name cmdtarg.cpp
Expand|Select|Wrap|Line Numbers
  1. CCmdTarget::~CCmdTarget()
  2.  
  3. {
  4.  
  5. #ifndef _AFX_NO_OLE_SUPPORT
  6.  
  7.       if (m_xDispatch.m_vtbl != 0)
  8.  
  9.             ((COleDispatchImpl*)&m_xDispatch)->Disconnect(); //This is the line where error is indicated
  10.  
  11.       ASSERT(m_dwRef <= 1);
  12.  
  13. #endif
  14.  
  15.       m_pModuleState = NULL;
  16.  
  17. }
[Please use CODE tags when posting source code. Thanks! --pbmods]

The same doesnot happen when i execute the program in debug mode. Also when i execute the program throught the executable the exiting doesnot give this error. Can someone please help.
Jul 11 '07 #1
Share this Question
Share on Google+
1 Reply


pbmods
Expert 5K+
P: 5,821
Heya, 4Codehelp.

I'm going to go ahead and move this thread to the C++ forum, where one of our resident Experts will be more likely to see it.
Jul 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Browse more C / C++ Questions on Bytes