From a42a703cb62c84b2ed141e64570e1f1a2d74695e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 2 Jun 2022 11:51:20 -0600 Subject: [PATCH] [shared_ptr] Clear p in destructor --- src/hb-cplusplus.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-cplusplus.hh b/src/hb-cplusplus.hh index afad2d1b8..76122523e 100644 --- a/src/hb-cplusplus.hh +++ b/src/hb-cplusplus.hh @@ -59,7 +59,7 @@ struct shared_ptr shared_ptr (shared_ptr &&o) : p (o.p) { o.p = nullptr; } shared_ptr& operator = (const shared_ptr &o) { if (p != o.p) { destroy (); p = o.p; reference (); } return *this; } shared_ptr& operator = (shared_ptr &&o) { destroy (); p = o.p; o.p = nullptr; return *this; } - ~shared_ptr () { v::destroy (p); } + ~shared_ptr () { v::destroy (p); p = nullptr; } T* get() const { return p; }