Skip to content

Commit

Permalink
Fix various components holding onto callbacks (#2451)
Browse files Browse the repository at this point in the history
* Possible fix for qdeleted callbacks with chickens

* Fix hanging action with rounys
  • Loading branch information
Absolucy authored Jun 29, 2024
1 parent 7003852 commit 1642176
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 6 deletions.
6 changes: 5 additions & 1 deletion monkestation/code/datums/components/multi_hit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@
src.stamina_cost = stamina_cost
item_parent = parent

/datum/component/multi_hit/Destroy(force, silent)
after_hit_callback = null
pre_hit_callback = null
return ..()

/datum/component/multi_hit/RegisterWithParent()
RegisterSignal(parent, COMSIG_ITEM_PRE_ATTACK, PROC_REF(pre_hit_callback))

/datum/component/multi_hit/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, COMSIG_ITEM_PRE_ATTACK)


/datum/component/multi_hit/proc/pre_hit_callback(datum/source, obj/item/thing, mob/user, params)
SIGNAL_HANDLER

Expand Down
4 changes: 4 additions & 0 deletions monkestation/code/modules/blueshift/benos/beno_types/rouny.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

add_movespeed_modifier(/datum/movespeed_modifier/alien_quick)

/mob/living/carbon/alien/adult/nova/runner/Destroy()
QDEL_NULL(evade_ability)
return ..()

/mob/living/carbon/alien/adult/nova/runner/create_internal_organs()
organs += new /obj/item/organ/internal/alien/plasmavessel/small/tiny
..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ component_cell_out_of_charge/component_cell_removed proc using loc where necessa
UnregisterSignal(parent, COMSIG_ATOM_EXAMINE)

/datum/component/cell/Destroy(force, silent)
if(on_cell_removed)
on_cell_removed = null
on_cell_removed = null
if(inserted_cell)
if(!inside_robot) //We really don't want to be deleting the robot's cell.
QDEL_NULL(inserted_cell)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
hanging_wall_turf = target_wall
on_drop = on_drop_callback

/datum/component/wall_mounted/Destroy(force, silent)
on_drop = null
return ..()

/datum/component/wall_mounted/RegisterWithParent()
ADD_TRAIT(parent, TRAIT_WALLMOUNTED, REF(src))
RegisterSignal(hanging_wall_turf, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
Expand Down
4 changes: 4 additions & 0 deletions monkestation/code/modules/liquids/liquid_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

interaction_callback = CALLBACK(parent, on_interaction_callback)

/datum/component/liquids_interaction/Destroy(force, silent)
interaction_callback = null
return ..()

/datum/component/liquids_interaction/RegisterWithParent()
RegisterSignal(parent, COMSIG_ITEM_AFTERATTACK, PROC_REF(AfterAttack)) //The only signal allowing item -> turf interaction

Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/modules/physics/physics_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@
set_angle(angle)

/datum/component/movable_physics/Destroy(force, silent)
. = ..()
bounce_callback = null
stop_callback = null
cached_transform = null
return ..()

/datum/component/movable_physics/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOVABLE_BUMP, PROC_REF(on_bump))
Expand Down
4 changes: 4 additions & 0 deletions monkestation/code/modules/ranching/components/aging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

START_PROCESSING(SSobj, src)

/datum/component/aging/Destroy(force, silent)
death_callback = null
return ..()

/datum/component/aging/RegisterWithParent()
. = ..()
RegisterSignal(parent, COMSIG_AGE_ADJUSTMENT, PROC_REF(adjust_age))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
src.unhappy_callbacks = unhappy_callbacks

/datum/component/happiness_container/Destroy(force, silent)
. = ..()
unhappy_callbacks = null
QDEL_NULL(applied_visual)
return ..()

/datum/component/happiness_container/RegisterWithParent()
. = ..()
Expand Down
4 changes: 4 additions & 0 deletions monkestation/code/modules/ranching/components/hatching.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@

START_PROCESSING(SSobj, src)

/datum/component/hatching/Destroy(force, silent)
hatch_callback = null
return ..()

/datum/component/hatching/process(seconds_per_tick)
if(!COOLDOWN_FINISHED(src, failed_cooldown))
return
Expand Down
5 changes: 5 additions & 0 deletions monkestation/code/modules/ranching/components/shearable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
created_amount = amount
src.created = created

/datum/component/shearable/Destroy(force, silent)
regrow = null
post_shear = null
return ..()

/datum/component/shearable/RegisterWithParent()
. = ..()
RegisterSignal(parent, COMSIG_MOB_SHEARED, PROC_REF(try_shear))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

/datum/component/latch_feeding/Destroy(force, silent)
REMOVE_TRAIT(parent, TRAIT_FEEDING, LATCH_TRAIT)
. = ..()
target = null
check_and_replace = null
return ..()

/datum/component/latch_feeding/RegisterWithParent()
RegisterSignal(parent, COMSIG_LIVING_SET_BUCKLED, PROC_REF(check_buckled))
Expand Down

0 comments on commit 1642176

Please sign in to comment.