Click here to Skip to main content
15,884,628 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionRe: is it true? fells he is boast, please somebody help me test . Pin
ZurdoDev18-May-15 4:54
professionalZurdoDev18-May-15 4:54 
QuestionServer execution failed in MFC COM Pin
Hydera29-Apr-15 23:59
Hydera29-Apr-15 23:59 
AnswerRe: Server execution failed in MFC COM Pin
achal375418-May-15 22:00
achal375418-May-15 22:00 
QuestionCListViewCtrl HitTest problem Pin
ush_28-Apr-15 9:38
ush_28-Apr-15 9:38 
Questioncannot get text of __DATE__ (resolved) Pin
bkelly1322-Apr-15 9:24
bkelly1322-Apr-15 9:24 
AnswerRe: cannot get text of __DATE__ Pin
Richard MacCutchan22-Apr-15 23:19
mveRichard MacCutchan22-Apr-15 23:19 
GeneralRe: cannot get text of __DATE__ Pin
bkelly1324-Apr-15 2:01
bkelly1324-Apr-15 2:01 
Questionfunction to delete a class (resolved) Pin
bkelly1321-Apr-15 3:42
bkelly1321-Apr-15 3:42 
This application has several pointers to be deleted in the destructor. Each is logged when created and again when deleted to reduce the possibility of an undetected memory leak. As there are several, a function is needed to do the deletes. The goal is to avoid writing all that logging code multiple times. Below is the concept. The first time it was tried the subject was an instance of a class with its own destructor. A breakpoint was placed in that destructor.
XML
Void Delete_Stuff( WCHAR * name, void * item )
{
If( item != NULL )
{
   Write_Log_Entry( L"Preparing to delete <name> at address <*item>"); // please see note
   delete ( item );  // does not call the destructor
   delete ( *item );  // illegal indirection
   }
}

EDIT: I wrote the text up in MS word and did not notice that the leading character of "delete" had been capitalized. Apologies for that.

Note: An swprintf_s(…) is used to build the string and the named function does the logging. Please accept the gross simplification used to make the main point obvious.
The destructor for the object is not called. I have tried a few combinations including * *. I managed to corrupt the heap at least once. Can this be fixed and work as desired or must each item be deleted one at a time without using the Delete_Stuff( … ) function.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com


modified 24-Apr-15 8:02am.

AnswerRe: function to delete a class Pin
Richard MacCutchan21-Apr-15 21:11
mveRichard MacCutchan21-Apr-15 21:11 
GeneralRe: function to delete a class Pin
bkelly1322-Apr-15 4:08
bkelly1322-Apr-15 4:08 
QuestionRe: function to delete a class Pin
Richard MacCutchan22-Apr-15 6:27
mveRichard MacCutchan22-Apr-15 6:27 
AnswerRe: function to delete a class Pin
bkelly1322-Apr-15 9:15
bkelly1322-Apr-15 9:15 
GeneralRe: function to delete a class Pin
Richard MacCutchan22-Apr-15 22:27
mveRichard MacCutchan22-Apr-15 22:27 
GeneralRe: function to delete a class Pin
bkelly1323-Apr-15 16:16
bkelly1323-Apr-15 16:16 
GeneralRe: function to delete a class Pin
Richard MacCutchan23-Apr-15 21:11
mveRichard MacCutchan23-Apr-15 21:11 
GeneralRe: function to delete a class Pin
Richard MacCutchan22-Apr-15 23:15
mveRichard MacCutchan22-Apr-15 23:15 
QuestionAlways on top (Task Manager) C# Pin
Rainsey Long25-Mar-15 5:45
Rainsey Long25-Mar-15 5:45 
AnswerRe: Always on top (Task Manager) C# Pin
Richard MacCutchan25-Mar-15 6:33
mveRichard MacCutchan25-Mar-15 6:33 
GeneralRe: Always on top (Task Manager) C# Pin
Rainsey Long25-Mar-15 7:01
Rainsey Long25-Mar-15 7:01 
GeneralRe: Always on top (Task Manager) C# Pin
Richard MacCutchan25-Mar-15 7:58
mveRichard MacCutchan25-Mar-15 7:58 
Questionwhere is WINVER set (resolved) Pin
bkelly1323-Mar-15 8:43
bkelly1323-Mar-15 8:43 
AnswerRe: where is WINVER set Pin
Richard MacCutchan23-Mar-15 22:27
mveRichard MacCutchan23-Mar-15 22:27 
AnswerRe: where is WINVER set Pin
Theo Buys2-Apr-15 0:27
Theo Buys2-Apr-15 0:27 
GeneralRe: where is WINVER set Pin
bkelly134-Apr-15 9:11
bkelly134-Apr-15 9:11 
QuestionUnicode and codeproject article Pin
bkelly1325-Feb-15 10:30
bkelly1325-Feb-15 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.