Click here to Skip to main content
15,904,023 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalvector and delete Pin
ns3-Nov-03 5:32
ns3-Nov-03 5:32 
GeneralRe: vector and delete Pin
valikac3-Nov-03 5:44
valikac3-Nov-03 5:44 
GeneralRe: vector and delete Pin
ns3-Nov-03 5:54
ns3-Nov-03 5:54 
GeneralRe: vector and delete Pin
jhwurmbach3-Nov-03 6:32
jhwurmbach3-Nov-03 6:32 
GeneralRe: vector and delete Pin
ns3-Nov-03 7:52
ns3-Nov-03 7:52 
GeneralRe: vector and delete Pin
TFrancis3-Nov-03 8:42
TFrancis3-Nov-03 8:42 
Generalthanks! Trying it out now...... Pin
ns3-Nov-03 8:53
ns3-Nov-03 8:53 
GeneralRe: thanks! Trying it out now...... Pin
souldog3-Nov-03 9:42
souldog3-Nov-03 9:42 
No, No, No..

Don't do this. Do not store the pointer returned by new anywhere else except the vector.
All access to that object should be through the pointer stored in the vector. Your problem
here is that you have many copies of the pointers floating around. You need to redesign your
application so that this is not the case.

if the code is inside the class pointed to then it should not be possible to call it in any other
way except through the pointer stored in the vector, so you don't need to check it for NULL
This is how it should be done.

ANy other way and you have
Code that is very hard to maintain and very error prone.

Can you explain why and how you are possibly calling a function in a class the instantiation of
has just been deleted from memory.



GeneralRe: thanks! Trying it out now...... Pin
ns4-Nov-03 2:04
ns4-Nov-03 2:04 
GeneralStruggling with Regex Pin
DimkaSPB3-Nov-03 5:27
DimkaSPB3-Nov-03 5:27 
GeneralRe: Struggling with Regex Pin
Michael Dunn3-Nov-03 5:33
sitebuilderMichael Dunn3-Nov-03 5:33 
GeneralRe: Struggling with Regex Pin
DimkaSPB3-Nov-03 7:32
DimkaSPB3-Nov-03 7:32 
GeneralRe: Struggling with Regex Pin
Michael Dunn3-Nov-03 7:41
sitebuilderMichael Dunn3-Nov-03 7:41 
Generaldumb question Pin
K. Shaffer3-Nov-03 5:19
K. Shaffer3-Nov-03 5:19 
GeneralRe: dumb question Pin
David Crow3-Nov-03 5:23
David Crow3-Nov-03 5:23 
GeneralRe: dumb question Pin
Michael Dunn3-Nov-03 5:27
sitebuilderMichael Dunn3-Nov-03 5:27 
GeneralRe: dumb question Pin
K. Shaffer3-Nov-03 5:37
K. Shaffer3-Nov-03 5:37 
GeneralRe: dumb question Pin
Maxwell Chen3-Nov-03 16:47
Maxwell Chen3-Nov-03 16:47 
GeneralRe: dumb question Pin
Alton Williams5-Nov-03 0:26
Alton Williams5-Nov-03 0:26 
GeneralMDI application & DLLs Pin
mfcbeginer3-Nov-03 5:06
mfcbeginer3-Nov-03 5:06 
GeneralSerialization questions Pin
Alton Williams3-Nov-03 4:35
Alton Williams3-Nov-03 4:35 
GeneralRe: Serialization questions Pin
Steve S3-Nov-03 22:59
Steve S3-Nov-03 22:59 
GeneralOverloading the << and >> operators CArchive Pin
Alton Williams3-Nov-03 4:27
Alton Williams3-Nov-03 4:27 
GeneralRe: Overloading the << and >> operators CArchive Pin
Steve S3-Nov-03 22:55
Steve S3-Nov-03 22:55 
GeneralRe: Overloading the << and >> operators CArchive Pin
Alton Williams3-Nov-03 23:20
Alton Williams3-Nov-03 23:20 

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.