Click here to Skip to main content
15,900,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CString problem Pin
david bagaturia25-Feb-07 21:04
david bagaturia25-Feb-07 21:04 
QuestionHow to create a new document template that does not have Frame/View Pin
Nataraj197825-Feb-07 19:56
Nataraj197825-Feb-07 19:56 
QuestionHow to show my program in context menu Pin
Max++25-Feb-07 19:55
Max++25-Feb-07 19:55 
AnswerRe: How to show my program in context menu Pin
Michael Dunn25-Feb-07 20:34
sitebuilderMichael Dunn25-Feb-07 20:34 
GeneralRe: How to show my program in context menu Pin
prasad_som25-Feb-07 20:37
prasad_som25-Feb-07 20:37 
AnswerRe: How to show my program in context menu Pin
prasad_som25-Feb-07 20:35
prasad_som25-Feb-07 20:35 
QuestionPreventing dangling pointers Pin
Waldermort25-Feb-07 19:53
Waldermort25-Feb-07 19:53 
AnswerRe: Preventing dangling pointers Pin
Cedric Moonen25-Feb-07 20:31
Cedric Moonen25-Feb-07 20:31 
And what is the problem exactly ? Because classA now holds a pointer that points to invalid memory ?
You said that DeleteAll is called at program termination, so what is the problem exactly ?

Anyway, what you could do, is to wrap your structure in a smart pointer. A smart pointer is a class that owns a pointer to a dynamically allocated object. It overload the -> and * operators so that you can use it as if you were using the nested object directly. The purpose of smart pointers is that they will destroy automatically the object as soon as nobody use it anymore. There is a reference counting in the smart counter and this ref counting is shared across all instances of the 'same' smart pointer (by same I mean the smart pointers that hold the same pointer). You can copy the smart pointer for example (this will increment the ref counting)...

There is a smart pointer class in the boost library. Take a look here[^] for a nice article about it.


Cédric Moonen
Software developer

Charting control [v1.1]

GeneralRe: Preventing dangling pointers Pin
Waldermort25-Feb-07 20:39
Waldermort25-Feb-07 20:39 
GeneralRe: Preventing dangling pointers Pin
ThatsAlok26-Feb-07 18:15
ThatsAlok26-Feb-07 18:15 
Questionallocator for a class derived from CDBVariant Pin
prithaa25-Feb-07 19:17
prithaa25-Feb-07 19:17 
QuestionRe: allocator for a class derived from CDBVariant Pin
prasad_som25-Feb-07 20:42
prasad_som25-Feb-07 20:42 
AnswerRe: allocator for a class derived from CDBVariant Pin
prithaa25-Feb-07 21:05
prithaa25-Feb-07 21:05 
GeneralRe: allocator for a class derived from CDBVariant Pin
Cedric Moonen25-Feb-07 21:31
Cedric Moonen25-Feb-07 21:31 
Questionlinking data structure to ODBC Pin
Susanta57825-Feb-07 18:59
Susanta57825-Feb-07 18:59 
AnswerRe: linking data structure to ODBC Pin
Try25-Feb-07 20:07
Try25-Feb-07 20:07 
GeneralRe: linking data structure to ODBC Pin
Susanta57828-Feb-07 0:41
Susanta57828-Feb-07 0:41 
QuestionProblems with clearing a combobox using ResetContent..? Pin
Vinod Sankaranarayanan25-Feb-07 18:58
Vinod Sankaranarayanan25-Feb-07 18:58 
AnswerRe: Problems with clearing a combobox using ResetContent..? Pin
ThatsAlok25-Feb-07 19:48
ThatsAlok25-Feb-07 19:48 
QuestionWhy? Pin
Rajesh R Subramanian25-Feb-07 20:35
professionalRajesh R Subramanian25-Feb-07 20:35 
AnswerRe: Why? Pin
Mark Salsbery26-Feb-07 7:53
Mark Salsbery26-Feb-07 7:53 
NewsPlease! Pin
Rajesh R Subramanian26-Feb-07 17:32
professionalRajesh R Subramanian26-Feb-07 17:32 
GeneralRe: Please! Pin
Mark Salsbery27-Feb-07 7:46
Mark Salsbery27-Feb-07 7:46 
GeneralRe: Please! Pin
Rajesh R Subramanian27-Feb-07 8:13
professionalRajesh R Subramanian27-Feb-07 8:13 
GeneralRe: Please! Pin
Mark Salsbery27-Feb-07 8:33
Mark Salsbery27-Feb-07 8:33 

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.