[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[vsipl++] [patch] Fix for Fir destructor not getting called
- To: VSIPL++ Developers List <vsipl++@xxxxxxxxxxxxxxxx>
- Subject: [vsipl++] [patch] Fix for Fir destructor not getting called
- From: Don McCoy <don@xxxxxxxxxxxxxxxx>
- Date: Sat, 07 Jun 2008 16:52:09 -0600
This patch fixes a problem in which the Ref_counted_ptr holder's count_
member was being incremented one too many times, resulting in the Fir
destructor not getting called.
The problem occurs because in the dispatch mechanism
(Evaluator::exec()), the Fir_impl backend is created and stored in a
Ref_counted_ptr object, then passed to the Fir class and stored in yet
another Ref_counted_ptr object. This results in a reference count of 2
after creation, inhibiting the destructor from being called when the Fir
object goes out of scope.
While this does in fact fix the problem, I would like to verify that it
is the correct fix in this case. Comments?
Regards,
--
Don McCoy
don (at) CodeSourcery
(888) 776-0262 / (650) 331-3385, x712
2008-06-07 Don McCoy <don@xxxxxxxxxxxxxxxx>
* src/vsip/core/cvsip/fir.hpp: Changed dispatch to avoid incrementing
the reference count twice when creating the backend (once on creation
and once when passing into the Ref_counted_ptr holder).
* src/vsip/opt/ipp/fir.hpp: Likewise.
* src/vsip/opt/signal/fir_opt.hpp: Likewise.
Index: src/vsip/core/cvsip/fir.hpp
===================================================================
--- src/vsip/core/cvsip/fir.hpp (revision 210702)
+++ src/vsip/core/cvsip/fir.hpp (working copy)
@@ -237,7 +237,8 @@
static return_type exec(aligned_array<T> k, length_type ks,
length_type is, length_type d,
unsigned n, alg_hint_type h)
- { return return_type(new cvsip::Fir_impl<T, S, C>(k, ks, is, d, n, h));}
+ { return return_type(new cvsip::Fir_impl<T, S, C>(k, ks, is, d, n, h),
+ noincrement);}
};
} // namespace vsip::impl::dispatcher
Index: src/vsip/opt/ipp/fir.hpp
===================================================================
--- src/vsip/opt/ipp/fir.hpp (revision 210702)
+++ src/vsip/opt/ipp/fir.hpp (working copy)
@@ -222,7 +222,7 @@
static return_type exec(aligned_array<T> k, length_type ks,
length_type is, length_type d,
unsigned int, alg_hint_type)
- { return return_type(new ipp::Fir_impl<T, S, C>(k, ks, is, d));}
+ { return return_type(new ipp::Fir_impl<T, S, C>(k, ks, is, d), noincrement);}
};
} // namespace vsip::impl::dispatcher
} // namespace vsip::impl
Index: src/vsip/opt/signal/fir_opt.hpp
===================================================================
--- src/vsip/opt/signal/fir_opt.hpp (revision 210702)
+++ src/vsip/opt/signal/fir_opt.hpp (working copy)
@@ -165,7 +165,7 @@
static return_type exec(aligned_array<T> k, length_type ks,
length_type is, length_type d,
unsigned, alg_hint_type)
- { return return_type(new Fir_impl<T, S, C>(k, ks, is, d));}
+ { return return_type(new Fir_impl<T, S, C>(k, ks, is, d), noincrement);}
};
}