gui/hdd_menu.cpp: fix memleaks when using CMenuForwarder;

disable hdd menu when recording
This commit is contained in:
[CST] Focus
2012-05-04 14:40:38 +04:00
parent af21835064
commit 609b448682

View File

@@ -114,8 +114,11 @@ int CHDDMenuHandler::doMenu ()
hddmenu->setSelected(2);
hddmenu->addIntroItems(LOCALE_HDD_SETTINGS);
CHDDFmtExec fmtexec;
CHDDChkExec chkexec;
hddmenu->addItem(new CMenuForwarder(LOCALE_HDD_ACTIVATE, true, "", new CHDDDestExec(), NULL, CRCInput::RC_red,NEUTRINO_ICON_BUTTON_RED));
CHDDDestExec hddexec;
hddmenu->addItem(new CMenuForwarder(LOCALE_HDD_ACTIVATE, true, "", &hddexec, NULL, CRCInput::RC_red,NEUTRINO_ICON_BUTTON_RED));
hddmenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_HDD_EXTENDED_SETTINGS));
@@ -188,17 +191,19 @@ int CHDDMenuHandler::doMenu ()
fscanf(f, "%d", &removable);
fclose(f);
bool enabled = !CNeutrinoApp::getInstance()->recordingstatus && !removable && !isroot;
snprintf(str, sizeof(str), "%s %s %lld %s", vendor, model, megabytes < 10000 ? megabytes : megabytes/1000, megabytes < 10000 ? "MB" : "GB");
printf("HDD: %s\n", str);
tmp_str[i]=str;
tempMenu[i] = new CMenuWidget(str, NEUTRINO_ICON_SETTINGS);
tempMenu[i]->addIntroItems();
//tempMenu->addItem( new CMenuOptionChooser(LOCALE_HDD_FS, &g_settings.hdd_fs, HDD_FILESYS_OPTIONS, HDD_FILESYS_OPTION_COUNT, true));
tempMenu[i]->addItem(new CMenuForwarder(LOCALE_HDD_FORMAT, true, "", new CHDDFmtExec, namelist[i]->d_name));
tempMenu[i]->addItem(new CMenuForwarder(LOCALE_HDD_CHECK, true, "", new CHDDChkExec, namelist[i]->d_name));
tempMenu[i]->addItem(new CMenuForwarder(LOCALE_HDD_FORMAT, true, "", &fmtexec, namelist[i]->d_name));
tempMenu[i]->addItem(new CMenuForwarder(LOCALE_HDD_CHECK, true, "", &chkexec, namelist[i]->d_name));
snprintf(sstr, sizeof(sstr), "%s (%s)", g_Locale->getText(LOCALE_HDD_REMOVABLE_DEVICE), namelist[i]->d_name);
hddmenu->addItem(new CMenuForwarderNonLocalized((removable ? sstr : namelist[i]->d_name), (removable || isroot) ? false : true, tmp_str[i], tempMenu[i]));
hddmenu->addItem(new CMenuForwarderNonLocalized((removable ? sstr : namelist[i]->d_name), enabled /*(removable || isroot) ? false : true*/, tmp_str[i], tempMenu[i]));
hdd_found = 1;
free(namelist[i]);