core: Poking at task cleanup.

This commit is contained in:
Cory McWilliams 2025-01-11 14:41:46 -05:00
parent aa15da50ab
commit 8216bdb4b3

View File

@ -1819,6 +1819,12 @@ void tf_task_destroy(tf_task_t* task)
{ {
JS_FreeValue(task->_context, task->_exports[i]->_function); JS_FreeValue(task->_context, task->_exports[i]->_function);
} }
while (task->_import_count)
{
while (!_import_record_release(&task->_imports[task->_import_count - 1]))
{
}
}
tf_free(task->_imports); tf_free(task->_imports);
tf_free(task->_exports); tf_free(task->_exports);
task->_imports = NULL; task->_imports = NULL;
@ -1831,10 +1837,7 @@ void tf_task_destroy(tf_task_t* task)
while (task->timeouts) while (task->timeouts)
{ {
timeout_t* timeout = task->timeouts; timeout_t* timeout = task->timeouts;
if (task->_context) JS_FreeValue(task->_context, timeout->_callback);
{
JS_FreeValue(task->_context, timeout->_callback);
}
timeout->_callback = JS_UNDEFINED; timeout->_callback = JS_UNDEFINED;
_timeout_unlink(task, timeout); _timeout_unlink(task, timeout);
uv_close((uv_handle_t*)&timeout->_timer, _timeout_closed); uv_close((uv_handle_t*)&timeout->_timer, _timeout_closed);
@ -1859,14 +1862,6 @@ void tf_task_destroy(tf_task_t* task)
tf_free(task->_promises); tf_free(task->_promises);
task->_promises = NULL; task->_promises = NULL;
tf_free(task->_imports);
task->_imports = NULL;
task->_import_count = 0;
tf_free(task->_exports);
task->_exports = NULL;
task->_export_count = 0;
if (task->_db) if (task->_db)
{ {
sqlite3_close(task->_db); sqlite3_close(task->_db);