From 6c666b0dfa38cf1f6407817261a829645e86d855 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 May 2013 18:50:32 -0400 Subject: Ignore requests to load transient objects in lazy pointers --- odb/tr1/lazy-ptr.ixx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'odb/tr1/lazy-ptr.ixx') diff --git a/odb/tr1/lazy-ptr.ixx b/odb/tr1/lazy-ptr.ixx index e524710..b33a12d 100644 --- a/odb/tr1/lazy-ptr.ixx +++ b/odb/tr1/lazy-ptr.ixx @@ -185,7 +185,7 @@ namespace odb inline std::tr1::shared_ptr lazy_shared_ptr:: load () const { - if (!loaded ()) + if (!p_ && i_) p_ = i_.template load (true); // Reset id. return p_; @@ -499,11 +499,12 @@ namespace odb { std::tr1::shared_ptr r (p_.lock ()); - if (r || !i_) - return r; + if (!r && i_) + { + r = i_.template load (false); // Keep id. + p_ = r; + } - r = i_.template load (false); // Keep id. - p_ = r; return r; } -- cgit v1.1