fixes null parent in destroy for components (#32351)

* fixes parent being null in destroy

* extends qdel
This commit is contained in:
Emmett Gaines
2017-11-07 15:35:09 -05:00
committed by CitadelStationBot
parent 36234e94d4
commit 8fb5936c30
4 changed files with 15 additions and 17 deletions
+7 -9
View File
@@ -14,8 +14,7 @@
var/list/arguments = args.Copy()
arguments.Cut(1, 2)
if(Initialize(arglist(arguments)) == COMPONENT_INCOMPATIBLE)
parent = null
qdel(src)
qdel(src, TRUE, TRUE)
return
_CheckDupesAndJoinParent(P)
@@ -36,13 +35,11 @@
switch(dm)
if(COMPONENT_DUPE_UNIQUE)
old.InheritComponent(src, TRUE)
parent = null //prevent COMPONENT_REMOVING signal, no _RemoveFromParent because we aren't in their list yet
qdel(src)
qdel(src, TRUE, TRUE)
return
if(COMPONENT_DUPE_HIGHLANDER)
InheritComponent(old, FALSE)
old._RemoveFromParent()
qdel(old)
qdel(old, FALSE, TRUE)
//provided we didn't eat someone
if(!old)
@@ -83,12 +80,14 @@
/datum/component/proc/Initialize(...)
return
/datum/component/Destroy()
/datum/component/Destroy(force=FALSE, silent=FALSE)
enabled = FALSE
var/datum/P = parent
if(P)
if(!force)
_RemoveFromParent()
if(!silent)
P.SendSignal(COMSIG_COMPONENT_REMOVING, src)
parent = null
LAZYCLEARLIST(signal_procs)
return ..()
@@ -107,7 +106,6 @@
dc -= I
if(!dc.len)
P.datum_components = null
parent = null
/datum/component/proc/RegisterSignal(sig_type_or_types, proc_or_callback, override = FALSE)
if(QDELETED(src))