📄 text1.txt
字号:
BoundsChecker found a memory leak in InitDialog because the CImageList pointer is allocated on the heap with
"new" but never deleted.
To solve this leak, I made pImageList a private variable instead of a pointer.
CImageList m_ImageList; //add this to the header file
You have to change the references to pImageList from pointers (pImageList->Create, etc.) to
non-pointers (m_ImageList.Create, etc.).
When this is done the memory leak goes away.
When you change drives, and if the current directory on the new drive happens to be root you get an
error(compiled under VC++ 4.2)because in the Add dirs to tree routine
void CDirectoryTree::AddDirsToTree(CString szStart, HTREEITEM htParent)
{
szStartDir.Format("%s\\*.*", szStart);
szStart is something like "c:\" so it already has the slash unlike
"d:\mydir" that does not have the slash. So you have to distinguish based on the current
directory name. A simpe way is as following
int len = strlen(szStart) - 1;
if(szStart[len] != '\\')
szStartDir.Format("%s\\*.*", szStart);
else
szStartDir.Format("%s*.*", szStart);
aLSO vc++ 4.2 complains about memory leak that I did not have time to look into.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -