diff options
author | Alex Hirsch <w4rh4wk@bluephoenix.at> | 2021-03-10 19:09:41 +0100 |
---|---|---|
committer | Alex Hirsch <w4rh4wk@bluephoenix.at> | 2021-03-10 19:12:23 +0100 |
commit | 09bda3f140937aaf5e4f028f7f04656ca30c7e6b (patch) | |
tree | 966de51ecde62fec690e273e7cbebdc9555b56a1 | |
parent | 85cb3c044d3d753658ad4aa7499cbe6b6ad92e7a (diff) |
Always dynamically allocate PropertyTable
- `Texture::~Texture` expects `props` to be dynamically allocated.
- `GetPropertyTable` returned a pointer to an existing `PropertyTable`
but is expected to return a newly, dynamically allocated one.
- `PropertyTable::PropertyTable()` suggests that an empty `element`
property is valid.
fix #46876
fix #45573
-rw-r--r-- | modules/fbx/fbx_parser/FBXDocumentUtil.cpp | 2 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXProperties.cpp | 5 | ||||
-rw-r--r-- | modules/fbx/fbx_parser/FBXProperties.h | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp index 835b66ab23..df50a32c39 100644 --- a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp +++ b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp @@ -160,7 +160,7 @@ const PropertyTable *GetPropertyTable(const Document &doc, DOMWarning("property table (Properties70) not found", element); } if (templateProps) { - return templateProps; + return new const PropertyTable(templateProps); } else { return new const PropertyTable(); } diff --git a/modules/fbx/fbx_parser/FBXProperties.cpp b/modules/fbx/fbx_parser/FBXProperties.cpp index 8ab94e1ef4..9a93da7944 100644 --- a/modules/fbx/fbx_parser/FBXProperties.cpp +++ b/modules/fbx/fbx_parser/FBXProperties.cpp @@ -150,6 +150,11 @@ PropertyTable::PropertyTable() : } // ------------------------------------------------------------------------------------------------ +PropertyTable::PropertyTable(const PropertyTable *templateProps) : + templateProps(templateProps), element() { +} + +// ------------------------------------------------------------------------------------------------ PropertyTable::PropertyTable(const ElementPtr element, const PropertyTable *templateProps) : templateProps(templateProps), element(element) { const ScopePtr scope = GetRequiredScope(element); diff --git a/modules/fbx/fbx_parser/FBXProperties.h b/modules/fbx/fbx_parser/FBXProperties.h index 27cacfaf76..0595b25fa7 100644 --- a/modules/fbx/fbx_parser/FBXProperties.h +++ b/modules/fbx/fbx_parser/FBXProperties.h @@ -137,6 +137,7 @@ class PropertyTable { public: // in-memory property table with no source element PropertyTable(); + PropertyTable(const PropertyTable *templateProps); PropertyTable(const ElementPtr element, const PropertyTable *templateProps); ~PropertyTable(); |