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