< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] hygienic tweak to DestroyUsage::destroy()



Since DestroyUsage::destroy() is not actually DestroyUsage's destructor, once it deletes member pointers, it should really NULL out the pointers. It wouldn't matter if it were a destructor, in which case we would be guaranteed that the whole DestroyUsage object would go away, but here there is no such guarantee. Certainly doesn't hurt to just NULL out the pointers.

Diffs from 1.9.6 attached, and here it is inline:

    if (mDialogSet)
    {
       delete mDialogSet;
+      mDialogSet = NULL;
    }
    else if (mDialog)
    {
       delete mDialog;
+      mDialog = NULL;
    }


-John Gregg

Index: DestroyUsage.cxx
===================================================================
--- DestroyUsage.cxx	(revision 27529)
+++ DestroyUsage.cxx	(working copy)
@@ -77,10 +77,12 @@
    if (mDialogSet)
    {
       delete mDialogSet;
+      mDialogSet = NULL;
    }
    else if (mDialog)
    {
       delete mDialog;
+      mDialog = NULL;
    }
    else if (mHandle.isValid())
    {