mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
gui/hdd_menu.cpp: fix memleaks when using CMenuForwarder;
disable hdd menu when recording
This commit is contained in:
@@ -114,8 +114,11 @@ int CHDDMenuHandler::doMenu ()
|
|||||||
hddmenu->setSelected(2);
|
hddmenu->setSelected(2);
|
||||||
|
|
||||||
hddmenu->addIntroItems(LOCALE_HDD_SETTINGS);
|
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));
|
hddmenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_HDD_EXTENDED_SETTINGS));
|
||||||
|
|
||||||
@@ -188,17 +191,19 @@ int CHDDMenuHandler::doMenu ()
|
|||||||
fscanf(f, "%d", &removable);
|
fscanf(f, "%d", &removable);
|
||||||
fclose(f);
|
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");
|
snprintf(str, sizeof(str), "%s %s %lld %s", vendor, model, megabytes < 10000 ? megabytes : megabytes/1000, megabytes < 10000 ? "MB" : "GB");
|
||||||
printf("HDD: %s\n", str);
|
printf("HDD: %s\n", str);
|
||||||
tmp_str[i]=str;
|
tmp_str[i]=str;
|
||||||
tempMenu[i] = new CMenuWidget(str, NEUTRINO_ICON_SETTINGS);
|
tempMenu[i] = new CMenuWidget(str, NEUTRINO_ICON_SETTINGS);
|
||||||
tempMenu[i]->addIntroItems();
|
tempMenu[i]->addIntroItems();
|
||||||
//tempMenu->addItem( new CMenuOptionChooser(LOCALE_HDD_FS, &g_settings.hdd_fs, HDD_FILESYS_OPTIONS, HDD_FILESYS_OPTION_COUNT, true));
|
//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_FORMAT, true, "", &fmtexec, 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_CHECK, true, "", &chkexec, namelist[i]->d_name));
|
||||||
|
|
||||||
snprintf(sstr, sizeof(sstr), "%s (%s)", g_Locale->getText(LOCALE_HDD_REMOVABLE_DEVICE), 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;
|
hdd_found = 1;
|
||||||
free(namelist[i]);
|
free(namelist[i]);
|
||||||
|
Reference in New Issue
Block a user