From e7e51cb35cf143153521f77173185fc37c738aff 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/qt/smart-ptr/lazy-ptr.ixx | 11 ++++++----- 1 file 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 inline QSharedPointer QLazySharedPointer:: load () const { - if (!loaded ()) + if (!p_ && i_) p_ = i_.template load (true); // Reset id. return p_; @@ -461,11 +461,12 @@ load () const { QSharedPointer r (p_.toStrongRef ()); - 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