Bug 1086 - sanity check for not calling Object::Dispose () twice
sanity check for not calling Object::Dispose () twice
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P5 enhancement
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-30 11:39 EDT by Nicola Baldo
Modified: 2011-03-31 07:00 EDT (History)
1 user (show)

See Also:


Attachments
sanity check on Object::Dispose() (1.51 KB, patch)
2011-03-30 11:39 EDT, Nicola Baldo
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Baldo 2011-03-30 11:39:07 EDT
Created attachment 1055 [details]
sanity check on Object::Dispose()

I wrote this patch to make sure that Object::Dispose () was not called twice on the same object in some code of mine. Is it of any real use?
Comment 1 Mathieu Lacage 2011-03-31 02:46:32 EDT
No, this is not needed:
1) it is already implemented. Did you not notice the m_disposed member variable ?
2) your implementation is not correct.

To summarize, you can already call Dispose many times on the same object or different objects aggregated together and DoDispose will be called only once for each aggregated object.
Comment 2 Nicola Baldo 2011-03-31 07:00:26 EDT
Fine, but then we(In reply to comment #1)
> No, this is not needed:
> 1) it is already implemented. Did you not notice the m_disposed member variable
> ?

I didn't notice because I was only looking at the doxygen documentation, which still said that it in as error to call Dispose twice. 

I just pushed changeset 6988:3f0d3324cbc5 to update the documentation according to your comment.