Scott Lawrence wrote: > On Tue, 2009-02-17 at 15:55 -0500, Dale Worley wrote: >> I'm working on SipRefreshManager, which maintains a UtlHashBag of >> RefreshDialogState objects. SipRefreshManager sets timers, and the >> timers' userData fields are pointers to the RefreshDialogState object >> that the timer concerns. The problem is: When a timer fires, how do I >> check that the RefreshDialogState object that the timer points to has >> not been removed from the UtlHashBag and deleted? > > I would put a reference count in the RefreshDialogState object and use > that to ensure that it cannot be deleted until there are no references > to it. Increment the reference when a timer starts or when it is added > to the container, and decrement when the timer fires or the object is > removed from the container. > > That way, your stored pointer is always good. > >
auto_ptr I am just envious: it was not part of the standard during my C++ days... D. _______________________________________________ sipx-dev mailing list [email protected] List Archive: http://list.sipfoundry.org/archive/sipx-dev Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev
