Use weak pointer for ElemBase last to avoid memory leak
parent
219dbbd4af
commit
30555282fe
|
@ -624,7 +624,9 @@ void Structure ::Convert<ListBase>(
|
||||||
const FileDatabase &db) const {
|
const FileDatabase &db) const {
|
||||||
|
|
||||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db);
|
ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db);
|
||||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.last, "*last", db);
|
std::shared_ptr<ElemBase> last;
|
||||||
|
ReadFieldPtr<ErrorPolicy_Igno>(last, "*last", db);
|
||||||
|
dest.last = last;
|
||||||
|
|
||||||
db.reader->IncPtr(size);
|
db.reader->IncPtr(size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ struct ID : ElemBase {
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct ListBase : ElemBase {
|
struct ListBase : ElemBase {
|
||||||
std::shared_ptr<ElemBase> first;
|
std::shared_ptr<ElemBase> first;
|
||||||
std::shared_ptr<ElemBase> last;
|
std::weak_ptr<ElemBase> last;
|
||||||
};
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue