VS 2005 pains

This is interesting, I am moving a vc++ project to VS 2005.  When i run it in debug mode i receive this error:

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: c:\Dev\Point\PointMain\Debug\Winpoint.exe
File: dbgdel.cpp
Line: 52

Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.


This I can trace back to the call to delete in this function:

    void RemoveIt(CDlgAncItem* item)
    {
        if (item)
        {
            RemoveIt(item->next);
            delete(item);
        }
    }

The CDlgAncItem is a class it has a destructor and a copy constructor.  I am not sure why the debugger is losing track of the memory, Its a pretty simple data structure stored in a dynamically allocated link list.
Edit: I found a solution.
Comments [0]
All comments require the approval of the site owner before being displayed.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview