Fix for font caching bug (table grow bug really), attepted fix for log change event loop
parent
71334b265d
commit
e9249a382a
|
@ -1,6 +1,6 @@
|
|||
#define MAJOR 4
|
||||
#define MINOR 0
|
||||
#define PATCH 22
|
||||
#define PATCH 23
|
||||
|
||||
// string
|
||||
#define VN__(a,b,c) #a "." #b "." #c
|
||||
|
|
|
@ -203,8 +203,11 @@ font_get_or_make_page(System_Functions *system, Render_Font *font, u32 page_numb
|
|||
if (pages != 0){
|
||||
memset(pages, 0, sizeof(*pages)*new_max);
|
||||
u32 old_max = font->page_max;
|
||||
Glyph_Page **old_pages = font->pages;
|
||||
font->pages = pages;
|
||||
font->page_max = new_max;
|
||||
for (u32 i = 0; i < old_max; ++i){
|
||||
Glyph_Page *this_page = pages[i];
|
||||
Glyph_Page *this_page = old_pages[i];
|
||||
if (this_page != FONT_PAGE_EMPTY && this_page != FONT_PAGE_DELETED){
|
||||
u32 this_page_number = this_page->page_number;
|
||||
Glyph_Page **dest = font_page_lookup(font, this_page_number, true);
|
||||
|
@ -212,9 +215,7 @@ font_get_or_make_page(System_Functions *system, Render_Font *font, u32 page_numb
|
|||
*dest = this_page;
|
||||
}
|
||||
}
|
||||
system->font.free(font->pages);
|
||||
font->pages = pages;
|
||||
font->page_max = new_max;
|
||||
system->font.free(old_pages);
|
||||
has_space = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#if defined(IS_PLAT_LAYER)
|
||||
|
||||
# if defined(USE_LOG)
|
||||
# define LOG(m) GEN_LOG(sysfunc.log, m)
|
||||
# define LOG(m) GEN_LOG(sysfunc.log, FNLN m)
|
||||
# else
|
||||
# define LOG(m)
|
||||
# endif
|
||||
|
||||
# if defined(USE_LOGF)
|
||||
# define LOGF(...) GEN_LOGF(sysfunc.log, __VA_ARGS__)
|
||||
# define LOGF(...) GEN_LOGF(sysfunc.log, FNLN __VA_ARGS__)
|
||||
# else
|
||||
# define LOGF(...)
|
||||
# endif
|
||||
|
@ -32,13 +32,13 @@
|
|||
#else /* Not platform layer */
|
||||
|
||||
# if defined(USE_LOG)
|
||||
# define LOG(s,m) GEN_LOG((s)->log, m)
|
||||
# define LOG(s,m) GEN_LOG((s)->log, FNLN m)
|
||||
# else
|
||||
# define LOG(s,m)
|
||||
# endif
|
||||
|
||||
# if defined(USE_LOGF)
|
||||
# define LOGF(s,...) GEN_LOGF((s)->log, __VA_ARGS__)
|
||||
# define LOGF(s,...) GEN_LOGF((s)->log, FNLN __VA_ARGS__)
|
||||
# else
|
||||
# define LOGF(s,...)
|
||||
# endif
|
||||
|
|
|
@ -221,36 +221,32 @@ get_change_event(File_Track_System *system, Partition *scratch, u8 *buffer, int3
|
|||
|
||||
if (n == -1 && errno != EAGAIN){
|
||||
perror("inotify read");
|
||||
} else if(n > 0){
|
||||
}
|
||||
else if (n > 0){
|
||||
ev = (struct inotify_event*) buff;
|
||||
|
||||
File_Index key = { ev->wd, 1 };
|
||||
File_Track_Entry *entry = tracking_system_lookup_entry(tables, key);
|
||||
Linux_File_Track_Entry *linux_entry = (Linux_File_Track_Entry*) entry;
|
||||
|
||||
LINUX_FN_DEBUG("mask: %#x", ev->mask);
|
||||
|
||||
if (!entry_is_available(entry)){
|
||||
|
||||
char* full_name = (char*) alloca(strlen(linux_entry->dir) + ev->len + 1);
|
||||
strcpy(full_name, linux_entry->dir);
|
||||
strcat(full_name, "/");
|
||||
strcat(full_name, ev->name);
|
||||
|
||||
LINUX_FN_DEBUG("event from wd %d (%s)", ev->wd, full_name);
|
||||
|
||||
size_t full_name_size = strlen(full_name);
|
||||
if (max < full_name_size){
|
||||
result = FileTrack_MemoryTooSmall;
|
||||
// NOTE(inso): this event will be dropped, needs to be stashed.
|
||||
LINUX_FN_DEBUG("max too small, event dropped");
|
||||
} else {
|
||||
}
|
||||
else{
|
||||
memcpy(buffer, full_name, full_name_size);
|
||||
*size = full_name_size;
|
||||
result = FileTrack_Good;
|
||||
}
|
||||
} else {
|
||||
LINUX_FN_DEBUG("dead event from wd %d", ev->wd);
|
||||
//LINUX_FN_DEBUG("dead event from wd %d", ev->wd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue