several memleak fixes; Dziekuje.

Origin commit data
------------------
Commit: 0f9cb1dc50
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-09-28 (Thu, 28 Sep 2017)

Origin message was:
------------------
- several memleak fixes; Dziekuje.
This commit is contained in:
vanhofen
2017-09-28 15:23:38 +02:00
parent cce7d1b424
commit c1535b5567
4 changed files with 22 additions and 7 deletions

View File

@@ -88,6 +88,7 @@ int CDaemonControlMenu::show()
daemonControlMenu->addIntroItems(); daemonControlMenu->addIntroItems();
CMenuOptionChooser *mc; CMenuOptionChooser *mc;
CFlagFileNotifier * flagFileNotifier[DAEMONS_COUNT];
for (unsigned int i = 0; i < DAEMONS_COUNT; i++) for (unsigned int i = 0; i < DAEMONS_COUNT; i++)
{ {
buf.str(""); buf.str("");
@@ -96,15 +97,18 @@ int CDaemonControlMenu::show()
daemons_data[i].flag_exist = file_exists(flagfile); daemons_data[i].flag_exist = file_exists(flagfile);
CFlagFileNotifier * flagFileNotifier = new CFlagFileNotifier(daemons_data[i].flag); flagFileNotifier[i] = new CFlagFileNotifier(daemons_data[i].flag);
mc = new CMenuOptionChooser(daemons_data[i].name, &daemons_data[i].flag_exist, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, flagFileNotifier, CRCInput::convertDigitToKey(daemon_shortcut++)); mc = new CMenuOptionChooser(daemons_data[i].name, &daemons_data[i].flag_exist, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, flagFileNotifier[i], CRCInput::convertDigitToKey(daemon_shortcut++));
mc->setHint(daemons_data[i].icon, daemons_data[i].desc); mc->setHint(daemons_data[i].icon, daemons_data[i].desc);
daemonControlMenu->addItem(mc); daemonControlMenu->addItem(mc);
} }
int res = daemonControlMenu->exec(NULL,""); int res = daemonControlMenu->exec(NULL,"");
daemonControlMenu->hide(); daemonControlMenu->hide();
for (unsigned int i = 0; i < DAEMONS_COUNT; i++)
delete flagFileNotifier[i];
delete daemonControlMenu;
return res; return res;
} }
@@ -172,6 +176,7 @@ int CCamdControlMenu::show()
camdControlMenu->addItem(GenericMenuSeparatorLine); camdControlMenu->addItem(GenericMenuSeparatorLine);
CMenuOptionChooser *mc; CMenuOptionChooser *mc;
CFlagFileNotifier * flagFileNotifier[CAMDS_COUNT];
for (unsigned int i = 0; i < CAMDS_COUNT; i++) for (unsigned int i = 0; i < CAMDS_COUNT; i++)
{ {
std::string vinfo = ""; std::string vinfo = "";
@@ -214,14 +219,17 @@ int CCamdControlMenu::show()
std::string hint(g_Locale->getText(camds_data[i].desc)); std::string hint(g_Locale->getText(camds_data[i].desc));
hint.append("\nvinfo: " + vinfo); hint.append("\nvinfo: " + vinfo);
CFlagFileNotifier * flagFileNotifier = new CFlagFileNotifier(camds_data[i].camd_file); flagFileNotifier[i] = new CFlagFileNotifier(camds_data[i].camd_file);
mc = new CMenuOptionChooser(camds_data[i].name, &camds_data[i].camd_runs, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, camds_data[i].camd_exist, flagFileNotifier, CRCInput::convertDigitToKey(camd_shortcut++)); mc = new CMenuOptionChooser(camds_data[i].name, &camds_data[i].camd_runs, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, camds_data[i].camd_exist, flagFileNotifier[i], CRCInput::convertDigitToKey(camd_shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, hint); mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, hint);
camdControlMenu->addItem(mc); camdControlMenu->addItem(mc);
} }
int res = camdControlMenu->exec(NULL,""); int res = camdControlMenu->exec(NULL,"");
camdControlMenu->hide(); camdControlMenu->hide();
for (unsigned int i = 0; i < CAMDS_COUNT; i++)
delete flagFileNotifier[i];
delete camdControlMenu;
return res; return res;
} }

View File

@@ -728,12 +728,14 @@ _show_menu:
} }
//NI //NI
int fake_hddpower = 0;
CTouchFileNotifier * hddpowerNotifier = NULL;
hddmenu->addItem(new CMenuSeparator()); hddmenu->addItem(new CMenuSeparator());
if (cs_get_revision() < 8) { if (cs_get_revision() < 8) {
//NI HDD power (HD1/BSE only) //NI HDD power (HD1/BSE only)
const char *flag_hddpower = FLAGDIR "/.hddpower"; const char *flag_hddpower = FLAGDIR "/.hddpower";
int fake_hddpower = file_exists(flag_hddpower); fake_hddpower = file_exists(flag_hddpower);
CTouchFileNotifier * hddpowerNotifier = new CTouchFileNotifier(flag_hddpower); hddpowerNotifier = new CTouchFileNotifier(flag_hddpower);
mc = new CMenuOptionChooser(LOCALE_HDD_POWER, &fake_hddpower, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, hddpowerNotifier, CRCInput::RC_yellow); mc = new CMenuOptionChooser(LOCALE_HDD_POWER, &fake_hddpower, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, hddpowerNotifier, CRCInput::RC_yellow);
mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_HDD_POWER); mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_HDD_POWER);
hddmenu->addItem(mc); hddmenu->addItem(mc);
@@ -797,7 +799,8 @@ _show_menu:
} }
int ret = hddmenu->exec(NULL, ""); int ret = hddmenu->exec(NULL, "");
if (hddpowerNotifier)
delete hddpowerNotifier;
delete hddmenu; delete hddmenu;
hdd_list.clear(); hdd_list.clear();
devtitle.clear(); devtitle.clear();

View File

@@ -210,6 +210,8 @@ int CInfoIconsSetup::menu()
infoiconsMenu->hide(); infoiconsMenu->hide();
delete infoiconsMenu; delete infoiconsMenu;
delete delFlagMenu; delete delFlagMenu;
for (int i = 0 ; i < MODE_ICONS_NR_OF_ENTRIES; i++)
delete flagchooser[i];
delete flagMenu; delete flagMenu;
return res; return res;
} }

View File

@@ -166,6 +166,8 @@ int CLCD4lSetup::show()
int res = lcd4lSetup->exec(NULL, ""); int res = lcd4lSetup->exec(NULL, "");
lcd4lSetup->hide(); lcd4lSetup->hide();
delete lcd_clock_a;
delete lcd_weather;
delete lcd4lSetup; delete lcd4lSetup;
// the things to do on exit // the things to do on exit