diff options
-rw-r--r-- | odb/boost/smart-ptr/lazy-ptr.ixx | 11 |
1 files changed, 6 insertions, 5 deletions
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<T> lazy_shared_ptr<T>:: load () const { - if (!loaded ()) + if (!p_ && i_) p_ = i_.template load<T> (true); // Reset id. return p_; @@ -536,11 +536,12 @@ namespace odb { ::boost::shared_ptr<T> r (p_.lock ()); - if (r || !i_) - return r; + if (!r && i_) + { + r = i_.template load<T> (false); // Keep id. + p_ = r; + } - r = i_.template load<T> (false); // Keep id. - p_ = r; return r; } |