mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
Fix memory leak of fonts, reduces memory usage by 3-5 MB.
Also fix caret not showing in servers list menu
This commit is contained in:
parent
f7364a0e63
commit
152a862f50
@ -1235,8 +1235,10 @@ static void ServersScreen_Tick(struct LScreen* s_) {
|
||||
const static String refresh = String_FromConst("Refresh");
|
||||
const static String failed = String_FromConst("&cFailed");
|
||||
struct ServersScreen* s = (struct ServersScreen*)s_;
|
||||
int count;
|
||||
LScreen_Tick(s_);
|
||||
|
||||
int count = FetchFlagsTask.Count;
|
||||
count = FetchFlagsTask.Count;
|
||||
LWebTask_Tick(&FetchFlagsTask.Base);
|
||||
/* TODO: Only redraw flags */
|
||||
if (count != FetchFlagsTask.Count) LWidget_Draw(&s->Table);
|
||||
|
@ -990,6 +990,16 @@ static void Font_DirCallback(const String* path, void* obj) {
|
||||
FT_Error err;
|
||||
int i, flags;
|
||||
|
||||
/* Completely skip windows .FON files */
|
||||
if (String_CaselessEnds(path, &fonExt)) return;
|
||||
|
||||
/* If font is already known good, skip it */
|
||||
for (i = 0; i < font_list.Entries.Count; i++) {
|
||||
entry = StringsBuffer_UNSAFE_Get(&font_list.Entries, i);
|
||||
String_UNSAFE_Separate(&entry, font_list.Separator, &name, &fontPath);
|
||||
if (String_CaselessEquals(path, &fontPath)) return;
|
||||
}
|
||||
|
||||
if (!Font_MakeArgs(path, &stream, &args)) return;
|
||||
|
||||
/* For OSX font suitcase files */
|
||||
@ -1001,16 +1011,6 @@ static void Font_DirCallback(const String* path, void* obj) {
|
||||
args.pathname = filename.buffer;
|
||||
#endif
|
||||
|
||||
/* If font is already known good, skip it */
|
||||
for (i = 0; i < font_list.Entries.Count; i++) {
|
||||
entry = StringsBuffer_UNSAFE_Get(&font_list.Entries, i);
|
||||
String_UNSAFE_Separate(&entry, font_list.Separator, &name, &fontPath);
|
||||
if (String_CaselessEquals(path, &fontPath)) return;
|
||||
}
|
||||
|
||||
/* Completely skip windows .FON files */
|
||||
if (String_CaselessEnds(path, &fonExt)) return;
|
||||
|
||||
err = FT_New_Face(ft_lib, &args, 0, &face);
|
||||
if (err) { stream.close(&stream); return; }
|
||||
flags = face->style_flags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user