Project

General

Profile

Actions

Bug #9678

open

Crash in Wt::Dbo if we clear a collection and add an item.

Added by Tomaz Canabrava about 2 years ago. Updated about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/28/2022
Due date:
% Done:

0%

Estimated time:

Actions #1

Updated by Tomaz Canabrava about 2 years ago

The following code crashes deep into Wt.
Wt version 4.6.0

template <class TYPE>
void reduceCollectionToOne(Wt::Dbo::collection<Wt::Dbo::ptr<TYPE>>& collection,
                           const Wt::Dbo::ptr<TYPE>& one)
{
    collection.clear();
    collection.insert(one);
}

Actions #2

Updated by Korneel Dumon about 2 years ago

I tried your function using the feature/dbo/tutorial2 example and it worked. I don't know what's going wrong for you, but you could check if the ptr argument is added to the session and if there is an active transaction.

Actions

Also available in: Atom PDF