aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-05-21 18:50:32 -0400
committerBoris Kolpackov <boris@codesynthesis.com>2013-05-21 18:50:32 -0400
commit1b2c7678a0978da1037e65a8e982f9d303e3a541 (patch)
tree5a196dec43fce4dcb2384e0959425c1266a094f4
parent64654174779a5a4f6163bca9164d65436dc5408c (diff)
Ignore requests to load transient objects in lazy pointers
-rw-r--r--odb/boost/smart-ptr/lazy-ptr.ixx11
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;
}