From 468fe81f61c3c74982b7a42a8d19d564bfd43459 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 20 Jul 2016 15:19:10 -0400 Subject: [PATCH] found and fixed thread bugs --- 4coder_mem.h | 6 +++--- 4ed_file_view.cpp | 4 ++-- win32_4ed.cpp | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/4coder_mem.h b/4coder_mem.h index 2d481a0d..980e8010 100644 --- a/4coder_mem.h +++ b/4coder_mem.h @@ -202,9 +202,9 @@ static void* general_memory_allocate(General_Memory *general, int32_t size){ void *result = 0; if (size < BUBBLE_MIN_SIZE) size = BUBBLE_MIN_SIZE; - for (Bubble *bubble = general->free_sentinel.next2; - bubble != &general->free_sentinel; - bubble = bubble->next2){ + for (Bubble *bubble = general->sentinel.next; + bubble != &general->sentinel; + bubble = bubble->next){ if (!(bubble->flags & MEM_BUBBLE_USED)){ if (bubble->size >= size){ result = bubble + 1; diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index 788ee03d..cabe9bea 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -1227,7 +1227,7 @@ Job_Callback_Sig(job_full_lex){ system->grow_thread_memory(memory); lex.tb = (char*)memory->data; tokens.tokens = (Cpp_Token*)((char*)memory->data + buffer_size); - tokens.max_count = memory->size / sizeof(Cpp_Token); + tokens.max_count = (memory->size - buffer_size) / sizeof(Cpp_Token); break; case LexHitTokenLimit: @@ -6119,7 +6119,7 @@ live_set_alloc_view(Live_Views *live_set, Panel *panel, Models *models){ init_query_set(&result.view->query_set); { - i32 gui_mem_size = Kbytes(32); + i32 gui_mem_size = Kbytes(512); void *gui_mem = general_memory_allocate(&models->mem.general, gui_mem_size + 8); result.view->gui_mem = gui_mem; gui_mem = advance_to_alignment(gui_mem); diff --git a/win32_4ed.cpp b/win32_4ed.cpp index bc646c27..40b15fc7 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -597,7 +597,7 @@ JobThreadProc(LPVOID lpParameter){ full_job->job.callback(&win32vars.system, thread, thread_memory, full_job->job.data); PostMessage(win32vars.window_handle, WM_4coder_ANIMATE, 0, 0); - full_job->running_thread = 0; + //full_job->running_thread = 0; thread->running = 0; system_acquire_lock(cancel_lock); @@ -688,7 +688,8 @@ flush_to_direct_queue(Unbounded_Work_Queue *source_queue, Work_Queue *queue, i32 } else if (source_queue->skip > UNBOUNDED_SKIP_MAX){ u32 left_over = source_queue->count - source_queue->skip; - memmove(queue->jobs, queue->jobs + source_queue->skip, left_over); + memmove(source_queue->jobs, source_queue->jobs + source_queue->skip, + sizeof(Full_Job_Data)*left_over); source_queue->count = left_over; source_queue->skip = 0; }