ntdll.dll!76fdfadc() 未知
[下面的架構可能不正确和/或缺失,沒有為 ntdll.dll 加載符号]
ntdll.dll!76fc4f92() 未知
ntdll.dll!76fa26fc() 未知
ntdll.dll!76fe0b37() 未知
ntdll.dll!76f9a967() 未知
kernel32.dll!750d14d1() 未知
msvcr110.dll!free(void * pBlock) 行 51 C
CThreeGridCtrlWithSign::`scalar deleting destructor'(unsigned int) C++
wxWindowBase::DestroyChildren(void) 未知
wxNavigationEnabled<wxWindow>::~wxNavigationEnabled<wxWindow>() C++
wxPanelBase::~wxPanelBase() C++
wxPanel::~wxPanel() C++
CFlightInstrumentPanel::~CFlightInstrumentPanel() 行 152 C++
CFlightInstrumentPanel::`scalar deleting destructor'(unsigned int) C++
在處理該問題上,通過不斷的屏蔽掉已有的功能,才解決這個問題
原因分析:拷貝一個字元串給類的字元串數組,由于過長,導緻數組越界,在析構類的時候,出現問題
問題回顧;free說明了類的釋放出現了問題,一個類的new操作,會配置設定一塊記憶體儲存類的成員變量,
delete的時候釋放,正常情況下,配置設定的記憶體會有一個結束的标志位,當出現數組越界情況下,标志位
被覆寫掉,導緻釋放記憶體的時候定位出錯
例子
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
class Test
{
private:
char m_szTitle[8];
public:
void SetTitle(char* szTitle)
{
strcpy(m_szTitle, szTitle);
}
};
int main(int argc, char* argv[])
Test* pTest = new Test();
pTest->SetTitle("http://fengyuzaitu.blog.51cto.com");
delete pTest;
return 0;
}
注意:調用strncpy就不會出現類似的問題,指定了拷貝的長度
本文轉自fengyuzaitu 51CTO部落格,原文連結:http://blog.51cto.com/fengyuzaitu/1887231,如需轉載請自行聯系原作者