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
commite7e51cb35cf143153521f77173185fc37c738aff (patch)
tree74da2cd6b6da7857ebab213cb5afc074f69fee68
parent0a05b227f19559da56a5b1aeeebd0ac4487085cb (diff)
Ignore requests to load transient objects in lazy pointers
-rw-r--r--odb/qt/smart-ptr/lazy-ptr.ixx11
1 files changed, 6 insertions, 5 deletions
diff --git a/odb/qt/smart-ptr/lazy-ptr.ixx b/odb/qt/smart-ptr/lazy-ptr.ixx
index 9d988a4..091d729 100644
--- a/odb/qt/smart-ptr/lazy-ptr.ixx
+++ b/odb/qt/smart-ptr/lazy-ptr.ixx
@@ -199,7 +199,7 @@ template <class T>
inline QSharedPointer<T> QLazySharedPointer<T>::
load () const
{
- if (!loaded ())
+ if (!p_ && i_)
p_ = i_.template load<T> (true); // Reset id.
return p_;
@@ -461,11 +461,12 @@ load () const
{
QSharedPointer<T> r (p_.toStrongRef ());
- 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;
}