Hi,
No, before deletion of the array, you have an array of possibly invalid references.
As long as a reference to a reference of an element of s_checkbox is not stored somewhere else, this is no problem and i assume that is why the comment exists.
If somewhere else just a copy of a reference is stored, you'd have no influence on it anyway, because by setting a pointer to null the copy of that copy will not become null.
Ciao
Holger
Originally posted by Martin Gühmann
If I understand it correctly nulling s_checkBox[i] like here:
Would give me a list of null pointers that are unrefferenced afterwards I delete s_checkBox itsself.
-Martin
If I understand it correctly nulling s_checkBox[i] like here:
Code:
for (sint32 i = 0; i < k_NUM_MAPSHAPEBOXES; i++ ) { delete s_checkBox[i]; // NULLing unnecessary: deleting the container next } delete [] s_checkBox; s_checkBox = NULL;
-Martin
As long as a reference to a reference of an element of s_checkbox is not stored somewhere else, this is no problem and i assume that is why the comment exists.
If somewhere else just a copy of a reference is stored, you'd have no influence on it anyway, because by setting a pointer to null the copy of that copy will not become null.
Ciao
Holger
Comment