- 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
parent afa022605a
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;
}
}

View file

@ -2892,8 +2892,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget)
PARAM_ANGLE_OPT(max_turn) { max_turn = 0; }
PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; }
PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; }
PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; }
PARAM_INT_OPT(flags) { max_turn = 0; }
PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; }
PARAM_INT_OPT(flags) { flags = 0; }
A_FaceTarget(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
return 0;
@ -2905,8 +2905,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster)
PARAM_ANGLE_OPT(max_turn) { max_turn = 0; }
PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; }
PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; }
PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; }
PARAM_INT_OPT(flags) { max_turn = 0; }
PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; }
PARAM_INT_OPT(flags) { flags = 0; }
A_FaceMaster(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
return 0;
@ -2918,8 +2918,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer)
PARAM_ANGLE_OPT(max_turn) { max_turn = 0; }
PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; }
PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; }
PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; }
PARAM_INT_OPT(flags) { max_turn = 0; }
PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; }
PARAM_INT_OPT(flags) { flags = 0; }
A_FaceTracer(self, max_turn, max_pitch, ang_offset, pitch_offset, flags);
return 0;