Given that the XMLDeleterFor<> is used to released memory allocated for a pointer of
global lifetime I'm not sure this is a problem.
Just to make it clear, here's the change that I propose:
XMLDeleterFor.hpp
-----------------
93c93
< XMLDeleterFor(T** toDelete);
---
> XMLDeleterFor(T* const toDelete);
112c112
< T** fToDelete;
---
> T* fToDelete;
XMLDeleterFor.c
---------------78c78
< template <class T> XMLDeleterFor<T>::XMLDeleterFor(T** toDelete) :
---
> template <class T> XMLDeleterFor<T>::XMLDeleterFor(T* const toDelete) :
86,87c86
< delete *fToDelete;
< *fToDelete = 0;
---
> delete fToDelete;
And then change all the code everywhere we create an XMLDeleterFor<> instance. For
example:
DOM_DOMImplementation.cpp
-------------------------
192c192
< new XMLDeleterFor<DOM_DOMImplementation>(&gDomimp)
---
> new XMLDeleterFor<DOM_DOMImplementation>(gDomimp)
On Wed, 05 September 2001, Dean Roddey wrote:
>
> If you copied the pointer somewhere else, i.e. orphaned it off to someone
> else, or just copied it somewhere, the deleter would write off into the
> ozone.
>
> --------------------------
> Dean Roddey
> The Charmed Quark Controller
> Charmed Quark Software
> [EMAIL PROTECTED]
> http://www.charmedquark.com
>
> "If it don't have a control port, don't buy it!"
>
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 05, 2001 9:20 PM
> Subject: Problem initializing and terminating XMLPlatformUtils
>
>
> > I have a need to initialize and terminate the utilities multiple time for
> a single process.
> >
> > For each lazily initialized data (or Singleton) we register an object that
> will perfom its cleanup (XMLDeleterFor<type>). It seems to me that if we
> modified the XMLDeleterFor<type> to not only delete the pointer but also set
> it to NULL this problem goes away.
> >
> > Is there a problem with doing this?
> >
> > Thanks,
> >
> > -Chris.
> >
> > __________________________________________________________
> > Get your FREE personalized e-mail at http://www.canada.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________________________________
Get your FREE personalized e-mail at http://www.canada.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]