From eba5deff498acba7fbc91c2bd00a2389d3fc0194 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sun, 15 Apr 2012 09:06:29 -0700 Subject: pmt: fix segfault in deleter --- gruel/src/lib/pmt/pmt.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gruel/src/lib/pmt/pmt.cc') diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc index 57b66b1a4..c100611be 100644 --- a/gruel/src/lib/pmt/pmt.cc +++ b/gruel/src/lib/pmt/pmt.cc @@ -58,7 +58,13 @@ pmt_base::operator delete(void *p, size_t size) #endif void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); } -void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) p->deleter_(p); } +void intrusive_ptr_release(pmt_base* p) { + if (--(p->count_) == 0 ){ + //make a copy of deleter before we delete its container, p + boost::function deleter = p->deleter_; + deleter(p); + } +} pmt_base::~pmt_base() { -- cgit