Skip to content

Commit f453d06

Browse files
YuriUfimtsevusiems
authored andcommitted
Add memory deallocation operators
1 parent 88b139a commit f453d06

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

generator/abstractmetabuilder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ AbstractMetaBuilder::AbstractMetaBuilder()
153153
AbstractMetaBuilder::~AbstractMetaBuilder()
154154
{
155155
qDeleteAll(m_meta_classes);
156+
qDeleteAll(m_enums);
156157
}
157158

158159
void AbstractMetaBuilder::checkFunctionModifications()
@@ -1170,6 +1171,9 @@ void AbstractMetaBuilder::traverseFunctions(ScopeModelItem scope_item, AbstractM
11701171
meta_class->setHasPublicDestructor(false);
11711172
}
11721173
meta_class->setHasVirtualDestructor(meta_function->isVirtual());
1174+
delete meta_function;
1175+
} else {
1176+
delete meta_function;
11731177
}
11741178
}
11751179
}
@@ -1510,6 +1514,7 @@ AbstractMetaFunction *AbstractMetaBuilder::traverseFunction(FunctionModelItem fu
15101514
UnmatchedArgumentType;
15111515
}
15121516
meta_function->setInvalid(true);
1517+
qDeleteAll(meta_arguments);
15131518
return meta_function;
15141519
}
15151520
AbstractMetaArgument *meta_argument = createMetaArgument();

generator/abstractmetalang.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
/*******************************************************************************
4848
* AbstractMetaType
4949
*/
50+
AbstractMetaType::~AbstractMetaType()
51+
{
52+
delete m_original_template_type;
53+
}
54+
5055
AbstractMetaType *AbstractMetaType::copy() const
5156
{
5257
AbstractMetaType *cpy = new AbstractMetaType;
@@ -97,6 +102,14 @@ QString AbstractMetaType::cppSignature() const
97102
return s;
98103
}
99104

105+
/*******************************************************************************
106+
* AbstractMetaVariable
107+
*/
108+
AbstractMetaVariable::~AbstractMetaVariable()
109+
{
110+
delete m_type;
111+
}
112+
100113
/*******************************************************************************
101114
* AbstractMetaArgument
102115
*/
@@ -746,6 +759,7 @@ AbstractMetaClass::~AbstractMetaClass()
746759
{
747760
qDeleteAll(m_functions);
748761
qDeleteAll(m_fields);
762+
qDeleteAll(m_property_specs);
749763
}
750764

751765
/*AbstractMetaClass *AbstractMetaClass::copy() const

generator/abstractmetalang.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ class AbstractMetaType
189189
{
190190
}
191191

192+
~AbstractMetaType();
193+
192194
QString package() const { return m_type_entry->javaPackage(); }
193195
QString name() const { return m_type_entry->targetLangName(); }
194196
QString fullName() const { return m_type_entry->qualifiedTargetLangName(); }
@@ -311,6 +313,7 @@ class AbstractMetaVariable
311313
{
312314
public:
313315
AbstractMetaVariable() = default;
316+
virtual ~AbstractMetaVariable();
314317

315318
AbstractMetaType *type() const { return m_type; }
316319
void setType(AbstractMetaType *type) { m_type = type; }
@@ -599,6 +602,7 @@ class AbstractMetaEnum : public AbstractMetaAttributes
599602
{
600603
public:
601604
AbstractMetaEnum() : m_has_qenums_declaration(false) {}
605+
~AbstractMetaEnum() { qDeleteAll(m_enum_values); }
602606

603607
AbstractMetaEnumValueList values() const { return m_enum_values; }
604608
void addEnumValue(AbstractMetaEnumValue *enumValue) { m_enum_values << enumValue; }

0 commit comments

Comments
 (0)