moar leak plug attempts

This commit is contained in:
marauder2k7 2025-05-08 20:40:17 +01:00
parent ea39c83afd
commit ee0cf872a0
6 changed files with 108 additions and 11 deletions

View file

@ -203,17 +203,108 @@ public:
ConsoleValue(ConsoleValue&& ref) noexcept ConsoleValue(ConsoleValue&& ref) noexcept
{ {
_move(std::move(ref)); type = ref.type;
switch (ref.type)
{
case cvInteger:
i = ref.i;
break;
case cvFloat:
f = ref.f;
break;
case cvSTEntry:
TORQUE_CASE_FALLTHROUGH;
case cvString:
s = ref.s;
ref.s = const_cast<char*>(StringTable->EmptyString());
break;
default:
data = ref.data;
break;
}
ref.type = ConsoleValueType::cvSTEntry;
ref.data = NULL;
} }
TORQUE_FORCEINLINE ConsoleValue& operator=(ConsoleValue&& ref) noexcept TORQUE_FORCEINLINE ConsoleValue& operator=(ConsoleValue&& ref) noexcept
{ {
_move(std::move(ref)); type = ref.type;
switch (ref.type)
{
case cvInteger:
i = ref.i;
break;
case cvFloat:
f = ref.f;
break;
case cvSTEntry:
TORQUE_CASE_FALLTHROUGH;
case cvString:
s = ref.s;
ref.s = const_cast<char*>(StringTable->EmptyString());
break;
default:
data = ref.data;
break;
}
ref.type = ConsoleValueType::cvSTEntry;
ref.data = NULL;
return *this; return *this;
} }
ConsoleValue(const ConsoleValue&) = delete; ConsoleValue(const ConsoleValue& ref)
ConsoleValue& operator=(const ConsoleValue&) = delete; {
type = ref.type;
switch (ref.type)
{
case cvInteger:
i = ref.i;
break;
case cvFloat:
f = ref.f;
break;
case cvSTEntry:
TORQUE_CASE_FALLTHROUGH;
case cvString:
s = ref.s;
break;
default:
data = ref.data;
break;
}
}
ConsoleValue& operator=(const ConsoleValue& ref)
{
type = ref.type;
switch (ref.type)
{
case cvInteger:
i = ref.i;
break;
case cvFloat:
f = ref.f;
break;
case cvSTEntry:
TORQUE_CASE_FALLTHROUGH;
case cvString:
s = ref.s;
break;
default:
data = ref.data;
break;
}
return *this;
}
TORQUE_FORCEINLINE ~ConsoleValue() TORQUE_FORCEINLINE ~ConsoleValue()
{ {
@ -1022,7 +1113,7 @@ namespace Con
ConsoleValue executef(R r, ArgTs ...argTs) ConsoleValue executef(R r, ArgTs ...argTs)
{ {
_EngineConsoleExecCallbackHelper<R> callback(r); _EngineConsoleExecCallbackHelper<R> callback(r);
return std::move(callback.template call<ConsoleValue>(argTs...)); return (callback.template call<ConsoleValue>(argTs...));
} }
/// } /// }
}; };

View file

@ -1159,7 +1159,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, SimObject *
{ {
if (mFunctionOffset) if (mFunctionOffset)
{ {
return std::move(mModule->exec(mFunctionOffset, argv[0].getString(), mNamespace, argc, argv, false, mPackage).value); return (mModule->exec(mFunctionOffset, argv[0].getString(), mNamespace, argc, argv, false, mPackage).value);
} }
else else
{ {
@ -1173,7 +1173,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, SimObject *
if (mToolOnly && !Con::isCurrentScriptToolScript()) if (mToolOnly && !Con::isCurrentScriptToolScript())
{ {
Con::errorf(ConsoleLogEntry::Script, "%s::%s - attempting to call tools only function from outside of tools", mNamespace->mName, mFunctionName); Con::errorf(ConsoleLogEntry::Script, "%s::%s - attempting to call tools only function from outside of tools", mNamespace->mName, mFunctionName);
return std::move(ConsoleValue()); return (ConsoleValue());
} }
#endif #endif

View file

@ -321,7 +321,7 @@ public:
void reset(); void reset();
inline ConsoleValue getValue() { return std::move(value); } inline ConsoleValue getValue() { return (value); }
inline U32 getIntValue() inline U32 getIntValue()
{ {

View file

@ -286,6 +286,12 @@ void AbstractClassRep::shutdown()
// Release storage allocated to the class table. // Release storage allocated to the class table.
for (auto walk = classLinkList; walk; walk = walk->nextClass)
{
walk->mFieldList.clear();
walk->mFieldList.compact(); // Important: frees the internal buffer
}
for (U32 group = 0; group < NetClassGroupsCount; group++) for (U32 group = 0; group < NetClassGroupsCount; group++)
for(U32 type = 0; type < NetClassTypesCount; type++) for(U32 type = 0; type < NetClassTypesCount; type++)
if( classTable[ group ][ type ] ) if( classTable[ group ][ type ] )

View file

@ -116,7 +116,7 @@ ConsoleValue SimConsoleThreadExecCallback::waitForResult()
{ {
if(sem->acquire(true)) if(sem->acquire(true))
{ {
return std::move(retVal); return (retVal);
} }
return ConsoleValue(); return ConsoleValue();

View file

@ -1,4 +1,4 @@
#ifndef _EVALSTATE_H #ifndef _EVALSTATE_H
#define _EVALSTATE_H #define _EVALSTATE_H
#include "console/consoleInternal.h" #include "console/consoleInternal.h"
@ -81,7 +81,7 @@ public:
currentRegisterArray->values[reg].setStringTableEntry(val); currentRegisterArray->values[reg].setStringTableEntry(val);
} }
TORQUE_FORCEINLINE void moveConsoleValue(S32 reg, ConsoleValue val) TORQUE_FORCEINLINE void moveConsoleValue(S32 reg, ConsoleValue&& val)
{ {
currentRegisterArray->values[reg] = std::move(val); currentRegisterArray->values[reg] = std::move(val);
} }