CStringList Error I Think 
Author Message
 CStringList Error I Think

I am getting an access violation when I try to clean up a CStringList
in a class destructor.  It seems to work some times and not at other
times.  I am using RemoveAll.   Below is the code that does the
deletion:

        if( m_oColumnLabels.GetSize() > 0)
        {
                m_oColumnLabels.RemoveAll();
        }
I have also tried just a RemoveAll without checking the size but I get
the same results.  What is also puzzling is that if I put a breakpoint
on the RemoveAll statement and wait before continuing I don't get the
error but this is not consistent either.  Below is a call stack:
__sbh_free_block(tagHeader * 0x011d1eb4, void * 0x02215e50) line 337 +
12 bytes
_free_base(void * 0x02215e50) line 52 + 13 bytes
_free_dbg_lk(void * 0x02215e70, int 1) line 1083 + 9 bytes
_free_dbg(void * 0x02215e70, int 1) line 970 + 13 bytes
operator delete(void * 0x02215e70) line 351 + 12 bytes
CString::FreeData() line 146 + 15 bytes
CString::~CString() line 213
PivotColumn::~PivotColumn() line 80 + 45 bytes

Any help would be greatly appreciated.

Thanks in advance!



Sat, 28 May 2005 08:29:20 GMT  
 CStringList Error I Think

Quote:

> I am getting an access violation when I try to clean up a CStringList
> in a class destructor.  It seems to work some times and not at other
> times.  I am using RemoveAll.   Below is the code that does the
> deletion:

>         if( m_oColumnLabels.GetSize() > 0)
>         {
>                 m_oColumnLabels.RemoveAll();
>         }
> I have also tried just a RemoveAll without checking the size but I get
> the same results.  What is also puzzling is that if I put a breakpoint
> on the RemoveAll statement and wait before continuing I don't get the
> error but this is not consistent either.  Below is a call stack:
> __sbh_free_block(tagHeader * 0x011d1eb4, void * 0x02215e50) line 337 +
> 12 bytes
> _free_base(void * 0x02215e50) line 52 + 13 bytes
> _free_dbg_lk(void * 0x02215e70, int 1) line 1083 + 9 bytes
> _free_dbg(void * 0x02215e70, int 1) line 970 + 13 bytes
> operator delete(void * 0x02215e70) line 351 + 12 bytes
> CString::FreeData() line 146 + 15 bytes
> CString::~CString() line 213
> PivotColumn::~PivotColumn() line 80 + 45 bytes

> Any help would be greatly appreciated.

> Thanks in advance!

Does a thread or a DLL set or change any of these strings?  A guess is
that you have more than one memory allocator, and memory allocated by A
cannot be freed by B.

--
Scott McPhillips [VC++ MVP]



Sat, 28 May 2005 09:43:25 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CStringList Error I Think

2. CStringList Error I Think

3. Afx error using CStringList->RemoveTail()

4. Thinking about WinHelp Tools? Think $$$

5. MFC CStringList and Managed C++

6. Help Using CStringList

7. Help with CStringList in CDocument used in CView

8. Help with Doc, Views, and CStringList

9. Serializing a CStringList

10. Integer Position in a CStringList Object

11. Question about CStringList

12. CStringList...and..CMemoryException..

 

 
Powered by phpBB® Forum Software