dont free memory already free

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-10 12:25:09 +03:00
parent e39c53e831
commit a3dc82d30b

View File

@ -4230,24 +4230,33 @@ InitTheme(
}
for (i = 0; i < 3; i++) {
DBG("validate %d face\n", i);
textFace[i].valid = FALSE;
}
DBG("...done\n");
/*
NSVGfont *nextFont, *font = fontsDB;
while (font) {
nextFont = font->next;
DBG("delete font %a\n", font->id);
nsvg__deleteFont(font);
DBG("...next\n");
font = nextFont;
}
DBG("...done\n");
fontsDB = NULL;
if (mainParser) {
nsvg__deleteParser(mainParser);
DBG("parser deleted\n");
mainParser = NULL;
}
*/
row0TileSize = 144;
row1TileSize = 64;
if (FontImage != NULL) {
DBG("free font image\n");
egFreeImage (FontImage);
FontImage = NULL;
}
@ -4256,6 +4265,7 @@ InitTheme(
// Free selection images which are not builtin icons
for (i = 0; i < 6; i++) {
DBG("free selection %d\n", i);
if (SelectionImages[i] != NULL) {
if ((SelectionImages[i] != BuiltinIconTable[BUILTIN_SELECTION_SMALL].Image) &&
(SelectionImages[i] != BuiltinIconTable[BUILTIN_SELECTION_BIG].Image)) {
@ -4264,18 +4274,20 @@ InitTheme(
SelectionImages[i] = NULL;
}
}
DBG("...done\n");
// Free banner which is not builtin icon
if (Banner != NULL) {
if (Banner != BuiltinIconTable[BUILTIN_ICON_BANNER].Image) {
DBG("free banner\n");
egFreeImage (Banner);
}
Banner = NULL;
}
DBG("...done\n");
//Free buttons images
for (i = 0; i < 4; i++) {
if (Buttons[i] != NULL) {
DBG("free button %d\n", i);
egFreeImage(Buttons[i]);
Buttons[i] = NULL;
}
@ -4286,20 +4298,22 @@ InitTheme(
//here we have no access to Mouse
// Invalidate BuiltinIcons
// DBG ("Invalidating BuiltinIcons...\n");
DBG ("Invalidating BuiltinIcons...\n");
for (i = 0; i < BUILTIN_ICON_COUNT; i++) {
if (BuiltinIconTable[i].Image != NULL) {
DBG("free builtin image %d\n", i);
egFreeImage (BuiltinIconTable[i].Image);
BuiltinIconTable[i].Image = NULL;
}
}
DBG("...done\n");
while (GuiAnime != NULL) {
GUI_ANIME *NextAnime = GuiAnime->Next;
DBG("free anime %d\n", GuiAnime->ID);
FreeAnime (GuiAnime);
GuiAnime = NextAnime;
}
DBG("...done\n");
GetThemeTagSettings(NULL);
if (ThemesNum > 0 &&
@ -4315,13 +4329,13 @@ InitTheme(
if (TestTheme != NULL) {
ThemeDict = LoadTheme (TestTheme);
if (ThemeDict != NULL) {
// DBG ("special theme %s found and %s parsed\n", TestTheme, CONFIG_THEME_FILENAME);
DBG ("special theme %s found and %s parsed\n", TestTheme, CONFIG_THEME_FILENAME);
if (GlobalConfig.Theme) {
FreePool (GlobalConfig.Theme);
}
GlobalConfig.Theme = TestTheme;
} else { // special theme not loaded
// DBG ("special theme %s not found, skipping\n", TestTheme, CONFIG_THEME_FILENAME);
DBG ("special theme %s not found, skipping\n", TestTheme, CONFIG_THEME_FILENAME);
FreePool (TestTheme);
}
TestTheme = NULL;