From 1b2c7678a0978da1037e65a8e982f9d303e3a541 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/boost/smart-ptr/lazy-ptr.ixx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'odb') diff --git a/odb/boost/smart-ptr/lazy-ptr.ixx b/odb/boost/smart-ptr/lazy-ptr.ixx index acc15e5..0de602c 100644 --- a/odb/boost/smart-ptr/lazy-ptr.ixx +++ b/odb/boost/smart-ptr/lazy-ptr.ixx @@ -199,7 +199,7 @@ namespace odb inline ::boost::shared_ptr lazy_shared_ptr:: load () const { - if (!loaded ()) + if (!p_ && i_) p_ = i_.template load (true); // Reset id. return p_; @@ -536,11 +536,12 @@ namespace odb { ::boost::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