开发者

visual c++ mfc mdi Access violation reading location 0x000fc2f0

开发者 https://www.devze.com 2023-01-06 09:22 出处:网络
i am doing a mdi project in vis开发者_如何学Cual c++ using mfc i am using a CArray to save and load data to documents. CArray contains members of a custom class of mine.

i am doing a mdi project in vis开发者_如何学Cual c++ using mfc i am using a CArray to save and load data to documents. CArray contains members of a custom class of mine.

Saving and loading works fine

I get access violation when closing a document that i have opened, and debugger points me to carray.

the weird thing is that i can close without problem "new" documents and the program crashes only when i am trying to close a document that i "open".

any idea how to fix it?


debugger points me to that code

i got the message "TYPE not found"

CArray::~CArray() { ASSERT_VALID(this);

  if (m_pData != NULL)
  {
      for( int i = 0; i < m_nSize; i++ )
          (m_pData + i)->~TYPE();
      delete[] (BYTE*)m_pData;
  }
}

what code u want to see exactly?

forgot to mention that if i open an empty document closing is working fine as well

0

精彩评论

暂无评论...
验证码 换一张
取 消