- don't delete any DObjects

FraggleScript's global_script was deleted instead of destroyed.
This commit is contained in:
Christoph Oelckers 2015-04-28 21:30:12 +02:00
commit 0f8972c96b
2 changed files with 7 additions and 27 deletions

View file

@ -170,7 +170,6 @@ DFsScript::DFsScript()
void DFsScript::Destroy()
{
if (this == global_script) global_script = NULL;
ClearVariables(true);
ClearSections();
ClearChildren();
@ -667,29 +666,10 @@ static int LS_FS_Execute (line_t *ln, AActor *it, bool backSide,
void FS_Close()
{
int i;
DFsVariable *current, *next;
if (global_script != NULL)
{
// we have to actually delete the global variables if we don't want
// to get them reported as memory leaks.
for (i = 0; i < VARIABLESLOTS; i++)
{
current = global_script->variables[i];
while (current)
{
next = current->next; // save for after freeing
current->ObjectFlags |= OF_YesReallyDelete;
delete current;
current = next; // go to next in chain
}
}
GC::DelSoftRoot(global_script);
global_script->ObjectFlags |= OF_YesReallyDelete;
delete global_script;
global_script->Destroy();
global_script = NULL;
}
}