diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-21 18:50:32 -0400 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-21 18:50:32 -0400 |
commit | 6c666b0dfa38cf1f6407817261a829645e86d855 (patch) | |
tree | ed37bde32f989b86fb637121092bad85c4149e06 /odb/tr1 | |
parent | 38b4810e67bf461ddad1cdd75b491ba7f8d5dd9b (diff) |
Ignore requests to load transient objects in lazy pointers
Diffstat (limited to 'odb/tr1')
-rw-r--r-- | odb/tr1/lazy-ptr.ixx | 11 |
1 files changed, 6 insertions, 5 deletions
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<T> lazy_shared_ptr<T>:: load () const { - if (!loaded ()) + if (!p_ && i_) p_ = i_.template load<T> (true); // Reset id. return p_; @@ -499,11 +499,12 @@ namespace odb { std::tr1::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; } |