Skip to content

Commit

Permalink
[MANUAL MIRROR] Fix some reference leaks (#18818)
Browse files Browse the repository at this point in the history
* Fix some reference leaks (#72669)

For some reason, this repo doesn't have a problem with these references,
but the downstream I work on catches these on the new 515 alternative GC
test 100% of the time, despite us having not modifying these types. Go
figure.

Removed the tank var from the mister as it's basically unused except to
leak a reference.

Garbage collector happy
Not player-facing

Co-authored-by: Jeremiah <[email protected]>

* Fixes the compile issue

---------

Co-authored-by: Tastyfish <[email protected]>
Co-authored-by: Jeremiah <[email protected]>
Co-authored-by: GoldenAlpharex <[email protected]>
  • Loading branch information
4 people authored Feb 3, 2023
1 parent 5c01998 commit 63fd00c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
5 changes: 2 additions & 3 deletions code/game/machinery/buttons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@
setup_device()

/obj/machinery/button/Destroy()
// Let them dump on the ground.
device = null
board = null
QDEL_NULL(device)
QDEL_NULL(board)
return ..()

/obj/machinery/button/update_icon_state()
Expand Down
11 changes: 2 additions & 9 deletions code/game/objects/items/tanks/watertank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,11 @@
item_flags = NOBLUDGEON | ABSTRACT // don't put in storage
slot_flags = NONE

var/obj/item/watertank/tank

/obj/item/reagent_containers/spray/mister/Initialize(mapload)
. = ..()
tank = loc
if(!tank?.reagents)
if(!loc?.reagents)
return INITIALIZE_HINT_QDEL
reagents = tank.reagents //This mister is really just a proxy for the tank's reagents

/obj/item/reagent_containers/spray/mister/Destroy(force)
tank = null
return ..()
reagents = loc.reagents //This mister is really just a proxy for the tank's reagents

/obj/item/reagent_containers/spray/mister/afterattack(obj/target, mob/user, proximity)
if(target.loc == loc) //Safety check so you don't fill your mister with mutagen or something and then blast yourself in the face with it
Expand Down

0 comments on commit 63fd00c

Please sign in to comment.