In expressInterest, just take a pointer to the Closure, not a shared_ptr
diff --git a/ndn-cpp/face.hpp b/ndn-cpp/face.hpp
index a730161..c646dab 100644
--- a/ndn-cpp/face.hpp
+++ b/ndn-cpp/face.hpp
@@ -18,17 +18,17 @@
class Face : public ElementListener {
public:
Face(const char *host, unsigned short port, const ptr_lib::shared_ptr<Transport> &transport)
- : host_(host), port_(port), transport_(transport)
+ : host_(host), port_(port), transport_(transport), tempClosure_(0)
{
}
Face(const char *host, unsigned short port)
- : host_(host), port_(port), transport_(new UdpTransport())
+ : host_(host), port_(port), transport_(new UdpTransport()), tempClosure_(0)
{
}
Face(const char *host)
- : host_(host), port_(9695), transport_(new UdpTransport())
+ : host_(host), port_(9695), transport_(new UdpTransport()), tempClosure_(0)
{
}
@@ -38,12 +38,12 @@
* closure->upcall(UPCALL_DATA (or UPCALL_DATA_UNVERIFIED),
* UpcallInfo(this, interest, 0, data)).
* @param name reference to a Name for the interest. This does not keep a pointer to the Name object.
- * @param closure a shared_ptr for the Closure. This uses shared_ptr to take another reference to the object.
+ * @param closure a pointer for the Closure. The caller must manage the memory for the Closure. This will not try to delete it.
* @param interestTemplate if not 0, copy interest selectors from the template. This does not keep a pointer to the Interest object.
*/
- void expressInterest(const Name &name, const ptr_lib::shared_ptr<Closure> &closure, const Interest *interestTemplate);
+ void expressInterest(const Name &name, Closure *closure, const Interest *interestTemplate);
- void expressInterest(const Name &name, const ptr_lib::shared_ptr<Closure> &closure)
+ void expressInterest(const Name &name, Closure *closure)
{
expressInterest(name, closure, 0);
}
@@ -62,7 +62,7 @@
ptr_lib::shared_ptr<Transport> transport_;
string host_;
unsigned short port_;
- ptr_lib::shared_ptr<Closure> tempClosure_;
+ Closure *tempClosure_;
};
}