1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixes from valgrind

This commit is contained in:
Brian Fiete 2022-03-18 18:06:14 -07:00
parent 0feaaded22
commit 676e7988fb
31 changed files with 243 additions and 147 deletions

View file

@ -1574,9 +1574,13 @@ BfMethodInstanceGroup::BfMethodInstanceGroup(BfMethodInstanceGroup&& prev) noexc
mOwner = prev.mOwner;
mDefault = prev.mDefault;
mMethodSpecializationMap = prev.mMethodSpecializationMap;
mDefaultCustomAttributes = prev.mDefaultCustomAttributes;
mMethodIdx = prev.mMethodIdx;
mRefCount = prev.mRefCount;
mOnDemandKind = prev.mOnDemandKind;
mExplicitlyReflected = prev.mExplicitlyReflected;
mHasEmittedReference = prev.mHasEmittedReference;
if (mDefault != NULL)
mDefault->mMethodInstanceGroup = this;
if (mMethodSpecializationMap != NULL)
@ -1584,9 +1588,8 @@ BfMethodInstanceGroup::BfMethodInstanceGroup(BfMethodInstanceGroup&& prev) noexc
for (auto& pair : *mMethodSpecializationMap)
pair.mValue->mMethodInstanceGroup = this;
}
mDefaultCustomAttributes = prev.mDefaultCustomAttributes;
prev.mDefaultCustomAttributes = NULL;
prev.mRefCount = 0;
prev.mDefault = NULL;
prev.mMethodSpecializationMap = NULL;
@ -2716,10 +2719,17 @@ void BfClosureType::Finish()
BfDelegateType::~BfDelegateType()
{
mMethodInstanceGroups.Clear();
delete mTypeDef;
delete mTypeDef;
mTypeDef = NULL;
}
void BfDelegateType::Dispose()
{
delete mTypeDef;
mTypeDef = NULL;
BfTypeInstance::Dispose();
}
//////////////////////////////////////////////////////////////////////////
BfTupleType::BfTupleType()
@ -2766,6 +2776,17 @@ void BfTupleType::Init(BfProject* bfProject, BfTypeInstance* valueTypeInstance)
mCreatedTypeDef = true;
}
void BfTupleType::Dispose()
{
if (mCreatedTypeDef)
{
delete mTypeDef;
mTypeDef = NULL;
mCreatedTypeDef = false;
}
BfTypeInstance::Dispose();
}
BfFieldDef* BfTupleType::AddField(const StringImpl& name)
{
return BfDefBuilder::AddField(mTypeDef, NULL, name);
@ -2790,8 +2811,8 @@ void BfTupleType::Finish()
BfBoxedType::~BfBoxedType()
{
if ((mTypeDef != NULL) && (mTypeDef->mEmitParent != NULL))
mTypeDef = NULL;
//if ((mTypeDef != NULL) && (mTypeDef->mEmitParent != NULL))
mTypeDef = NULL;
}
BfType* BfBoxedType::GetModifiedElementType()
@ -2940,7 +2961,7 @@ BfVariant BfResolvedTypeSet::EvaluateToVariant(LookupContext* ctx, BfExpression*
outType = NULL;
BfConstResolver constResolver(ctx->mModule);
BfVariant variant = { BfTypeCode_None };
BfVariant variant;
constResolver.mAllowGenericConstValue = true;
constResolver.mBfEvalExprFlags = BfEvalExprFlags_NoCast;
constResolver.mExpectingType = ctx->mModule->GetPrimitiveType(BfTypeCode_Int64);