Home » U++ Library support » U++ Core » ~Link
~Link [message #38843] |
Wed, 23 January 2013 12:26 |
masu
Messages: 378 Registered: February 2006
|
Senior Member |
|
|
Hi,
I made a little test with Link utility class and heap leaks have been detected when I use the following code:
struct LinkTest : Link<LinkTest> {
};
CONSOLE_APP_MAIN
{
LinkTest lt;
lt.InsertPrev();
lt.InsertNext();
lt.Dump();
}
This comes from the fact that the whole list is not destroyed when the destructor of lt is called at the end of the programm, but instead only lt is removed and the other heap allocated members in the list remain.
I propose to call DeleteList() in ~Link instead of calling UnLinkAll(). If one wants to unlink a single object obj within the list an obj.UnlinkAll() can be used.
It just does not feel the U++ way to me to have to call lt.DeleteList() at the end of the program.
Regards
Matthias
|
|
|
Goto Forum:
Current Time: Fri Mar 29 02:03:13 CET 2024
Total time taken to generate the page: 0.00967 seconds
|