SRL Archive - Reflection Development

Possible code8 fix


Markus

2011-02-20 15:58:23

Use after free = ugly. Took me 45 seconds to find once someone told me objects were leaking. Really.


*** Objects.simba Sun Feb 20 20:54:04 2011
--- Objects2.simba Sun Feb 20 20:54:36 2011
***************
*** 75,87 ****

{*******************************************************************************
function GetInteractableAt(T: TTile): TRSObject;
! By: Drags111 modified/fixed by pyroryan. Fixed by Markus
Description: Returns the objType Interactable ID at the given tile. Interactable
objects include anything clickable that isnt a WallObject.
*******************************************************************************}
function GetInteractableAt(T: TTile): TRSObject;
var
! Plane, Ground, Node, Node2, Obj, ObjTemp, ID, LX, LY: integer;
TempBox: TBox;
TempTile, L, Base: TTile;
begin
--- 75,87 ----

{*******************************************************************************
function GetInteractableAt(T: TTile): TRSObject;
! By: Drags111 modified/fixed by pyroryan
Description: Returns the objType Interactable ID at the given tile. Interactable
objects include anything clickable that isnt a WallObject.
*******************************************************************************}
function GetInteractableAt(T: TTile): TRSObject;
var
! Plane, Ground, Node, Obj, ObjTemp, ID, LX, LY: integer;
TempBox: TBox;
TempTile, L, Base: TTile;
begin
***************
*** 129,137 ****
end;
SmartFreeObject(obj);
SmartFreeObject(ObjTemp);
- Node2 := SmartGetFieldObject(Node, hook_AnimableNode_GetNext);
SmartFreeObject(Node);
! Node := Node2;
end;

finally
--- 129,136 ----
end;
SmartFreeObject(obj);
SmartFreeObject(ObjTemp);
SmartFreeObject(Node);
! Node := SmartGetFieldObject(Node, hook_AnimableNode_GetNext);
end;

finally

Train

2011-02-20 16:32:47

I saw these a few days ago… The whole include is full of leaks.
There's a few more in those functions too.

Markus

2011-02-20 16:42:37

Yea, I noticed this isn't the only one as my script still crashed (but at a later point).

Train

2011-02-20 17:04:59

The function exits without freeing node and tempnode.

Nava2

2011-02-20 18:19:38

Are the finallys not there to catch that..?

Wizzup?

2011-02-21 08:59:30

From: Train
I saw these a few days ago… The whole include is full of leaks.
There's a few more in those functions too.


Why didn't you fix them?