Packages: fix circular refernece bug
Packages had a strong back-pointer to their catalog, creating a circular reference loop. Break this so catalogs & packages are freed on exit.
This commit is contained in:
parent
ed8ff68114
commit
6d892e8d18
@ -34,7 +34,7 @@ namespace simgear {
|
|||||||
namespace pkg {
|
namespace pkg {
|
||||||
|
|
||||||
Package::Package(const SGPropertyNode* aProps, CatalogRef aCatalog) :
|
Package::Package(const SGPropertyNode* aProps, CatalogRef aCatalog) :
|
||||||
m_catalog(aCatalog)
|
m_catalog(aCatalog.get())
|
||||||
{
|
{
|
||||||
initWithProps(aProps);
|
initWithProps(aProps);
|
||||||
}
|
}
|
||||||
@ -235,6 +235,11 @@ std::string Package::id() const
|
|||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CatalogRef Package::catalog() const
|
||||||
|
{
|
||||||
|
return {m_catalog};
|
||||||
|
}
|
||||||
|
|
||||||
std::string Package::qualifiedId() const
|
std::string Package::qualifiedId() const
|
||||||
{
|
{
|
||||||
return m_catalog->id() + "." + id();
|
return m_catalog->id() + "." + id();
|
||||||
|
@ -130,8 +130,7 @@ public:
|
|||||||
|
|
||||||
size_t fileSizeBytes() const;
|
size_t fileSizeBytes() const;
|
||||||
|
|
||||||
CatalogRef catalog() const
|
CatalogRef catalog() const;
|
||||||
{ return m_catalog; }
|
|
||||||
|
|
||||||
bool matches(const SGPropertyNode* aFilter) const;
|
bool matches(const SGPropertyNode* aFilter) const;
|
||||||
|
|
||||||
@ -236,7 +235,7 @@ private:
|
|||||||
SGPropertyNode_ptr m_props;
|
SGPropertyNode_ptr m_props;
|
||||||
std::string m_id;
|
std::string m_id;
|
||||||
string_set m_tags;
|
string_set m_tags;
|
||||||
CatalogRef m_catalog;
|
Catalog* m_catalog = nullptr; // non-owning ref, explicitly
|
||||||
string_list m_variants;
|
string_list m_variants;
|
||||||
|
|
||||||
mutable function_list<InstallCallback> _install_cb;
|
mutable function_list<InstallCallback> _install_cb;
|
||||||
|
Loading…
Reference in New Issue
Block a user