fix delete fonts

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-13 11:44:45 +03:00
parent 697cc5e4b9
commit 07f5c88a8f
2 changed files with 60 additions and 57 deletions

View File

@ -1,13 +1,13 @@
/* /*
* a class to keep definitions for all theme settings * a class to keep definitions for all theme settings
*/ */
#include "XTheme.h" #include "XTheme.h"
Icon::Icon() {} Icon::Icon() {}
Icon::~Icon() {} Icon::~Icon() {}
XTheme::XTheme() XTheme::XTheme()
{ {
DisableFlags = 0; DisableFlags = 0;
HideBadges = 0; HideBadges = 0;
HideUIFlags = 0; HideUIFlags = 0;
@ -53,49 +53,49 @@ XTheme::XTheme()
Codepage = 0xC0; //this is for PNG theme Codepage = 0xC0; //this is for PNG theme
CodepageSize = 0xC0; // INTN CodepageSize; //extended latin CodepageSize = 0xC0; // INTN CodepageSize; //extended latin
Scale = 1.0f; Scale = 1.0f;
CentreShift = 0.0f; CentreShift = 0.0f;
} }
XImage& XTheme::GetIcon(XStringW& Name, BOOLEAN Night) XImage& XTheme::GetIcon(XStringW& Name, BOOLEAN Night)
{ {
XImage* TheIcon = NULL; XImage* TheIcon = NULL;
for (size_t i = 0; i < Icons.size(); i++) for (size_t i = 0; i < Icons.size(); i++)
{ {
if (Icons[i].Name == Name) if (Icons[i].Name == Name)
{ {
if (Night) { if (Night) {
TheIcon = &Icons[i].ImageNight; TheIcon = &Icons[i].ImageNight;
} }
if (TheIcon == NULL || (*TheIcon).isEmpty()) { //if daylight or night icon absent if (TheIcon == NULL || (*TheIcon).isEmpty()) { //if daylight or night icon absent
TheIcon = &Icons[i].Image; TheIcon = &Icons[i].Image;
} }
break; break;
} }
} }
return *TheIcon; return *TheIcon;
} }
XImage& XTheme::GetIcon(INTN Id, BOOLEAN Night) XImage& XTheme::GetIcon(INTN Id, BOOLEAN Night)
{ {
XImage* TheIcon = NULL; XImage* TheIcon = NULL;
for (size_t i = 0; i < Icons.size(); i++) for (size_t i = 0; i < Icons.size(); i++)
{ {
if (Icons[i].Id == Id) if (Icons[i].Id == Id)
{ {
if (Night) { if (Night) {
TheIcon = &Icons[i].ImageNight; TheIcon = &Icons[i].ImageNight;
} }
if (TheIcon == NULL || (*TheIcon).isEmpty()) { //if daylight or night icon absent if (TheIcon == NULL || (*TheIcon).isEmpty()) { //if daylight or night icon absent
TheIcon = &Icons[i].Image; TheIcon = &Icons[i].Image;
} }
break; break;
} }
} }
return *TheIcon; return *TheIcon;
} }
void XTheme::AddIcon(Icon& NewIcon) void XTheme::AddIcon(Icon& NewIcon)
{ {
Icons.AddCopy(NewIcon); Icons.AddCopy(NewIcon);
} }

View File

@ -630,18 +630,21 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
// OSIcons // OSIcons
NSVGfontChain *fontChain = fontsDB; NSVGfontChain *fontChain = fontsDB;
while (fontChain) { while (fontChain) {
DBG("free fontChain \n");
font = fontChain->font; font = fontChain->font;
NSVGfontChain *nextChain = fontChain->next;
if (font) { if (font) {
nsvg__deleteFont(font); nsvg__deleteFont(font);
fontChain->font = NULL; fontChain->font = NULL;
} }
fontChain = fontChain->next; FreePool(fontChain);
fontChain = nextChain->next;
} }
// nsvg__deleteParser(mainParser); //temporary disabled // nsvg__deleteParser(mainParser); //temporary disabled
//destruct_globals_objects(NULL); //we can't destruct our globals here. We need, for example, Volumes. //destruct_globals_objects(NULL); //we can't destruct our globals here. We need, for example, Volumes.
//DumpKernelAndKextPatches(Entry->KernelAndKextPatches); //DumpKernelAndKextPatches(Entry->KernelAndKextPatches);
DBG("start loader\n");
// Load image into memory (will be started later) // Load image into memory (will be started later)
Status = LoadEFIImage(Entry->DevicePath, Basename(Entry->LoaderPath), NULL, &ImageHandle); Status = LoadEFIImage(Entry->DevicePath, Basename(Entry->LoaderPath), NULL, &ImageHandle);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {