mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-12-24 13:48:04 +08:00
fix: onstop check
This commit is contained in:
@@ -284,6 +284,9 @@ func (task *Task) Using(resource ...any) {
|
||||
}
|
||||
|
||||
func (task *Task) OnStop(resource any) {
|
||||
if t, ok := resource.(ITask); ok && t.GetTask() == task {
|
||||
panic("onStop resource is task itself")
|
||||
}
|
||||
task.closeOnStop = append(task.closeOnStop, resource)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user