mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
gui/update.cpp: fix memleaks when using CMenuForwarder
Origin commit data
------------------
Commit: 809bb1b0a3
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-05-05 (Sat, 05 May 2012)
This commit is contained in:
@@ -144,6 +144,8 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
int selected = -1, listWidth = w_max (80, 10);
|
int selected = -1, listWidth = w_max (80, 10);
|
||||||
int curVer, newVer, newfound = 0;
|
int curVer, newVer, newfound = 0;
|
||||||
|
|
||||||
|
std::vector<CUpdateMenuTarget*> update_t_list;
|
||||||
|
|
||||||
CConfigFile _configfile('\t');
|
CConfigFile _configfile('\t');
|
||||||
const char * versionString = (_configfile.loadConfig("/.version")) ? (_configfile.getString( "version", "????????????????").c_str()) : "????????????????";
|
const char * versionString = (_configfile.loadConfig("/.version")) ? (_configfile.getString( "version", "????????????????").c_str()) : "????????????????";
|
||||||
installedVersion = versionString;
|
installedVersion = versionString;
|
||||||
@@ -235,7 +237,9 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
|
descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */
|
||||||
|
|
||||||
//SelectionWidget.addItem(new CMenuForwarderNonLocalized(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected)));
|
//SelectionWidget.addItem(new CMenuForwarderNonLocalized(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected)));
|
||||||
SelectionWidget.addItem(new CMenuForwarderNonLocalized(descriptions[i].c_str(), enabled, names[i].c_str(), new CUpdateMenuTarget(i, &selected)));
|
CUpdateMenuTarget * up = new CUpdateMenuTarget(i, &selected);
|
||||||
|
update_t_list.push_back(up);
|
||||||
|
SelectionWidget.addItem(new CMenuForwarderNonLocalized(descriptions[i].c_str(), enabled, names[i].c_str(), up));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,6 +259,9 @@ bool CFlashUpdate::selectHttpImage(void)
|
|||||||
|
|
||||||
SelectionWidget.exec(NULL, "");
|
SelectionWidget.exec(NULL, "");
|
||||||
|
|
||||||
|
for (std::vector<CUpdateMenuTarget*>::iterator it = update_t_list.begin(); it != update_t_list.end(); ++it)
|
||||||
|
delete (*it);
|
||||||
|
|
||||||
if (selected == -1)
|
if (selected == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user