mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fix /datum/scheduled_task was unable to be GC'd and was deleted.
In addition to fixing the problem, it makes sense. The observer pattern is overkill for an object type we own; doing it directly in Destroy() is more efficient.
This commit is contained in:
@@ -46,12 +46,9 @@
|
||||
|
||||
/datum/controller/process/scheduler/proc/schedule(var/datum/scheduled_task/st)
|
||||
scheduled_tasks += st
|
||||
destroyed_event.register(st, src, /datum/controller/process/scheduler/proc/unschedule)
|
||||
|
||||
/datum/controller/process/scheduler/proc/unschedule(var/datum/scheduled_task/st)
|
||||
if(st in scheduled_tasks)
|
||||
scheduled_tasks -= st
|
||||
destroyed_event.unregister(st, src)
|
||||
scheduled_tasks -= st
|
||||
|
||||
/**********
|
||||
* Helpers *
|
||||
@@ -102,6 +99,7 @@
|
||||
task_after_process_args += src
|
||||
|
||||
/datum/scheduled_task/Destroy()
|
||||
scheduler.unschedule(src)
|
||||
procedure = null
|
||||
arguments.Cut()
|
||||
task_after_process = null
|
||||
|
||||
Reference in New Issue
Block a user