From a2fdaba16d096c265be6b495a8dd88860047ef29 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 3 Sep 2003 18:17:49 +0000 Subject: [PATCH] fixed a potentially fatal error of doing a delete in a destructor on the object containing the destructor. --- Cantera/src/units.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Cantera/src/units.h b/Cantera/src/units.h index b36766b78..f0ea6a54f 100644 --- a/Cantera/src/units.h +++ b/Cantera/src/units.h @@ -13,9 +13,14 @@ namespace Cantera { return __u; } + static void deleteUnit() { + if (__u) { + delete __u; + __u = 0; + } + } + virtual ~Unit() { - delete __u; - __u = 0; } doublereal actEnergyToSI(string units) {