Revert commit a9cb69 : remove workaround and fix operator = in XIcon.

This commit is contained in:
jief666 2021-05-17 08:52:17 +03:00
parent 1af86d0e9c
commit 82ba60a90a
3 changed files with 12 additions and 18 deletions

View File

@ -99,7 +99,10 @@ ImageNight.FromPNG(ACCESS_EMB_DATA(dark), ACCESS_EMB_SIZE(dark)); \
}
XIcon::~XIcon() {}
XIcon::~XIcon()
{
// memory leak : we can't free (yet?) ImageSVG and ImageSVGnight because operator might have copied it
}
XIcon::XIcon(INTN Index, bool TakeEmbedded) : Id(Index), Name(), Image(), ImageNight(), Native(false),
ImageSVG(nullptr), ImageSVGnight(nullptr), Empty(0)
@ -121,16 +124,13 @@ XIcon& XIcon::operator=(const XIcon& src)
{
Id = src.Id;
Name = src.Name;
if (!src.isEmpty()) {
Image = src.Image;
if (!src.ImageNight.isEmpty()) {
ImageNight = src.ImageNight;
}
setFilled();
Native = src.Native;
Empty = src.Empty;
//this moment we copy pointers. Later it will be class variables
ImageSVG = src.ImageSVG;
ImageSVGnight = src.ImageSVGnight;
}
return *this;
}

View File

@ -3179,7 +3179,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
#endif // ENABLE_SECURE_BOOT
}
}
MenuEntryOptions.Image.ImageNight.setEmpty();
MenuEntryOptions.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
// DBG("Options: IconID=%lld name=%s empty=%s\n", MenuEntryOptions.Image.Id, MenuEntryOptions.Image.Name.c_str(),
// MenuEntryOptions.Image.isEmpty()?"пусто":"нет");
@ -3187,7 +3187,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
MenuEntryOptions.ShortcutLetter = 0x00;
MainMenu.AddMenuEntry(&MenuEntryOptions, false);
MenuEntryAbout.Image.ImageNight.setEmpty();
MenuEntryAbout.Image = ThemeX.GetIcon((INTN)BUILTIN_ICON_FUNC_ABOUT);
// DBG("About: IconID=%lld name=%s empty=%s\n", MenuEntryAbout.Image.Id, MenuEntryAbout.Image.Name.c_str(),
// MenuEntryAbout.Image.isEmpty()?"пусто":"нет");
@ -3198,12 +3197,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_FUNCS) || MainMenu.Entries.size() == 0) {
if (gSettings.Boot.DisableCloverHotkeys)
MenuEntryReset.ShortcutLetter = 0x00;
MenuEntryReset.Image.ImageNight.setEmpty();
MenuEntryReset.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_RESET);
MainMenu.AddMenuEntry(&MenuEntryReset, false);
if (gSettings.Boot.DisableCloverHotkeys)
MenuEntryShutdown.ShortcutLetter = 0x00;
MenuEntryShutdown.Image.ImageNight.setEmpty();
MenuEntryShutdown.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_EXIT);
MainMenu.AddMenuEntry(&MenuEntryShutdown, false);
}

View File

@ -1080,7 +1080,6 @@ void AboutRefit(void)
if (AboutMenu.Entries.size() == 0) {
AboutMenu.Daylight = ThemeX.Daylight;
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
AboutMenu.TitleImage.ImageNight.setEmpty();
AboutMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_ABOUT);
}
// else {
@ -1139,7 +1138,6 @@ void HelpRefit(void)
if (HelpMenu.Entries.size() == 0) {
HelpMenu.Daylight = ThemeX.Daylight;
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
HelpMenu.TitleImage.ImageNight.setEmpty();
HelpMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_HELP);
}
//else {
@ -2604,7 +2602,6 @@ void OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
if (OptionMenu.Entries.size() == 0) {
OptionMenu.Daylight = ThemeX.Daylight;
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
OptionMenu.TitleImage.ImageNight.setEmpty();
OptionMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
}
gThemeOptionsChanged = TRUE;