From 01d21b3ea20571979fdcb634393eedab450db5df Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 24 May 2007 15:37:00 +0200 Subject: [PATCH] add tests and fix leak --- src/core/ptr.cc | 2 ++ src/core/ptr.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/ptr.cc b/src/core/ptr.cc index 81a608b80..275a11324 100644 --- a/src/core/ptr.cc +++ b/src/core/ptr.cc @@ -284,10 +284,12 @@ PtrTest::RunTests (void) { Ptr p = MakeNewObject (cb); Callback callback = MakeCallback (&NoCount::Nothing, p); + callback (); } { Ptr p = MakeNewObject (cb); Callback callback = MakeCallback (&NoCount::Nothing, p); + callback (); } #if 0 diff --git a/src/core/ptr.h b/src/core/ptr.h index 18ba47228..ca3957be8 100644 --- a/src/core/ptr.h +++ b/src/core/ptr.h @@ -179,11 +179,12 @@ struct CallbackTraits > { static T & GetReference (Ptr const p) { - return *GetPointer (p); + return *PeekPointer (p); } }; + } // namespace ns3