From 48bd3352896f3a973827d79bba9c007005c3a706 Mon Sep 17 00:00:00 2001 From: aandrei Date: Fri, 8 Mar 2002 21:28:12 +0000 Subject: [PATCH] // March 08, 2002: moved the assignment to pTrackerArray in SetLongevity to fix // exception safety issue. Credit due to Kari Hoijarvi git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@13 7ec92016-0320-0410-acc4-a06ded1c099a --- Singleton.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Singleton.h b/Singleton.h index e0d86bc..00c4a23 100644 --- a/Singleton.h +++ b/Singleton.h @@ -106,12 +106,12 @@ namespace Loki sizeof(T) * (elements + 1))); if (!pNewArray) throw std::bad_alloc(); - LifetimeTracker* p = new ConcreteLifetimeTracker( - pDynObject, longevity, d); - // Delayed assignment for exception safety pTrackerArray = pNewArray; + LifetimeTracker* p = new ConcreteLifetimeTracker( + pDynObject, longevity, d); + // Insert a pointer to the object into the queue TrackerArray pos = std::upper_bound( pTrackerArray, @@ -439,6 +439,8 @@ namespace Loki // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // January 08, 2002: Fixed bug in call to realloc - credit due to Nigel Gent and // Eike Petersen +// March 08, 2002: moved the assignment to pTrackerArray in SetLongevity to fix +// exception safety issue. Credit due to Kari Hoijarvi //////////////////////////////////////////////////////////////////////////////// #endif // SINGLETON_INC_