- don't delete any DObjects
FraggleScript's global_script was deleted instead of destroyed.
This commit is contained in:
parent
afa022605a
commit
0f8972c96b
2 changed files with 7 additions and 27 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue