Sigh. Linked list bugs.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4806 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2024-01-27 21:53:57 +00:00
parent dc655bb359
commit 21e6cf10b6
2 changed files with 12 additions and 8 deletions

View File

@ -213,6 +213,11 @@ debug: LDFLAGS += -fsanitize=address -fsanitize=undefined
endif endif
endif endif
ifeq ($(UNAME_M),aarch64)
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
debug: LDFLAGS += -fsanitize=address -fsanitize=undefined
endif
get_objs = \ get_objs = \
$(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \ $(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
$(foreach build_type,debug release,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix))))) \ $(foreach build_type,debug release,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix))))) \

View File

@ -2053,15 +2053,14 @@ static void _timeout_link(tf_task_t* task, timeout_t* timeout)
{ {
assert(!timeout->previous); assert(!timeout->previous);
assert(!timeout->next); assert(!timeout->next);
timeout->previous = task->timeouts ? task->timeouts->previous : timeout; timeout->previous = timeout;
timeout->next = task->timeouts ? task->timeouts: timeout; timeout->next = timeout;
if (task->timeouts) if (task->timeouts)
{ {
timeout->previous = task->timeouts->previous;
timeout->next = task->timeouts;
task->timeouts->previous->next = timeout;
task->timeouts->previous = timeout; task->timeouts->previous = timeout;
if (task->timeouts->next == task->timeouts)
{
task->timeouts->next = timeout;
}
} }
task->timeouts = timeout; task->timeouts = timeout;
} }
@ -2070,7 +2069,7 @@ static void _timeout_unlink(tf_task_t* task, timeout_t* timeout)
{ {
assert(timeout->previous); assert(timeout->previous);
assert(timeout->next); assert(timeout->next);
if (timeout->next == timeout && timeout->previous == timeout) if (timeout->next == timeout && timeout->previous == timeout && task->timeouts == timeout)
{ {
task->timeouts = NULL; task->timeouts = NULL;
} }
@ -2105,8 +2104,8 @@ static void _util_timeoutCallback(uv_timer_t* handle)
tf_util_report_error(context, result); tf_util_report_error(context, result);
JS_FreeValue(context, result); JS_FreeValue(context, result);
JS_FreeValue(context, timeout->_callback); JS_FreeValue(context, timeout->_callback);
tf_trace_end(tf_task_get_trace(timeout->_task));
_timeout_unlink(timeout->_task, timeout); _timeout_unlink(timeout->_task, timeout);
tf_trace_end(tf_task_get_trace(timeout->_task));
uv_close((uv_handle_t*)handle, _timeout_closed); uv_close((uv_handle_t*)handle, _timeout_closed);
} }