aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/connection.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-29 09:58:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-30 10:07:08 +0200
commit2c15821eb8a9d6a7f79b7194b23d84dd8bb773c7 (patch)
tree2c598b57ddfc358914cdefaeec34d32e6c1847db /odb/sqlite/connection.cxx
parent344fd3309516aaa7faa8d0b91511ed868a5d60a4 (diff)
Allow active objects to remain on list after call to clear()
Diffstat (limited to 'odb/sqlite/connection.cxx')
-rw-r--r--odb/sqlite/connection.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/odb/sqlite/connection.cxx b/odb/sqlite/connection.cxx
index c9e5d75..cdd4c20 100644
--- a/odb/sqlite/connection.cxx
+++ b/odb/sqlite/connection.cxx
@@ -187,11 +187,19 @@ namespace odb
{
invalidate_results ();
- // The current first active_object will remove itself from the list
- // and make the second object (if any) the new first.
+ // The current first active_object may remove itself from the list and
+ // make the second object (if any) the new first.
//
- while (active_objects_ != 0)
- active_objects_->clear ();
+ for (active_object** pp (&active_objects_); *pp != nullptr; )
+ {
+ active_object* p (*pp);
+ p->clear ();
+
+ // Move to the next object if this one decided to stay on the list.
+ //
+ if (*pp == p)
+ pp = &p->next_;
+ }
}
// connection_factory