mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
gui/keybind_setup.cpp: fix memleak: in case not all keys
from 'enum keynames' added to menu, memory leaked. make sure all keychoosers deleted
This commit is contained in:
@@ -215,6 +215,9 @@ int CKeybindSetup::showKeySetup()
|
|||||||
CMenuWidget bindSettings(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING);
|
CMenuWidget bindSettings(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING);
|
||||||
|
|
||||||
//keybindings
|
//keybindings
|
||||||
|
for (int i = 0; i < KEYBINDS_COUNT; i++)
|
||||||
|
keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS);
|
||||||
|
|
||||||
int shortcut = 1;
|
int shortcut = 1;
|
||||||
showKeyBindSetup(&bindSettings);
|
showKeyBindSetup(&bindSettings);
|
||||||
CMenuForwarder * mf;
|
CMenuForwarder * mf;
|
||||||
@@ -266,6 +269,8 @@ int CKeybindSetup::showKeySetup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete keySettings;
|
delete keySettings;
|
||||||
|
for (int i = 0; i < KEYBINDS_COUNT; i++)
|
||||||
|
delete keychooser[i];
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,9 +283,6 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
|
|||||||
|
|
||||||
bindSettings->addIntroItems(LOCALE_KEYBINDINGMENU_HEAD);
|
bindSettings->addIntroItems(LOCALE_KEYBINDINGMENU_HEAD);
|
||||||
|
|
||||||
for (int i = 0; i < KEYBINDS_COUNT; i++)
|
|
||||||
keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS);
|
|
||||||
|
|
||||||
//modes
|
//modes
|
||||||
CMenuWidget* bindSettings_modes = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MODES);
|
CMenuWidget* bindSettings_modes = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MODES);
|
||||||
showKeyBindModeSetup(bindSettings_modes);
|
showKeyBindModeSetup(bindSettings_modes);
|
||||||
@@ -311,7 +313,7 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
|
|||||||
|
|
||||||
//misc
|
//misc
|
||||||
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC));
|
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC));
|
||||||
//bindSettings->addItem(new CMenuDForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN]));
|
//bindSettings->addItem(new CMenuForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN]));
|
||||||
|
|
||||||
//Special keys
|
//Special keys
|
||||||
CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL);
|
CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL);
|
||||||
@@ -321,22 +323,22 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings)
|
|||||||
bindSettings->addItem(mf);
|
bindSettings->addItem(mf);
|
||||||
|
|
||||||
// unlock
|
// unlock
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]);
|
mf = new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]);
|
||||||
mf->setHint("", key_settings[KEY_UNLOCK].hint);
|
mf->setHint("", key_settings[KEY_UNLOCK].hint);
|
||||||
bindSettings->addItem(mf);
|
bindSettings->addItem(mf);
|
||||||
// screenshot
|
// screenshot
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]);
|
mf = new CMenuForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]);
|
||||||
mf->setHint("", key_settings[KEY_SCREENSHOT].hint);
|
mf->setHint("", key_settings[KEY_SCREENSHOT].hint);
|
||||||
bindSettings->addItem(mf);
|
bindSettings->addItem(mf);
|
||||||
#ifdef ENABLE_PIP
|
#ifdef ENABLE_PIP
|
||||||
// pip
|
// pip
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]);
|
mf = new CMenuForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]);
|
||||||
mf->setHint("", key_settings[KEY_PIP_CLOSE].hint);
|
mf->setHint("", key_settings[KEY_PIP_CLOSE].hint);
|
||||||
bindSettings->addItem(mf);
|
bindSettings->addItem(mf);
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]);
|
mf = new CMenuForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]);
|
||||||
mf->setHint("", key_settings[KEY_PIP_SETUP].hint);
|
mf->setHint("", key_settings[KEY_PIP_SETUP].hint);
|
||||||
bindSettings->addItem(mf);
|
bindSettings->addItem(mf);
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]);
|
mf = new CMenuForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]);
|
||||||
mf->setHint("", key_settings[KEY_PIP_SWAP].hint);
|
mf->setHint("", key_settings[KEY_PIP_SWAP].hint);
|
||||||
bindSettings->addItem(mf);
|
bindSettings->addItem(mf);
|
||||||
#endif
|
#endif
|
||||||
@@ -364,11 +366,11 @@ void CKeybindSetup::showKeyBindModeSetup(CMenuWidget *bindSettings_modes)
|
|||||||
bindSettings_modes->addIntroItems(LOCALE_KEYBINDINGMENU_MODECHANGE);
|
bindSettings_modes->addIntroItems(LOCALE_KEYBINDINGMENU_MODECHANGE);
|
||||||
|
|
||||||
// tv/radio
|
// tv/radio
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
|
mf = new CMenuForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
|
||||||
mf->setHint("", key_settings[KEY_TV_RADIO_MODE].hint);
|
mf->setHint("", key_settings[KEY_TV_RADIO_MODE].hint);
|
||||||
bindSettings_modes->addItem(mf);
|
bindSettings_modes->addItem(mf);
|
||||||
|
|
||||||
mf = new CMenuDForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
|
mf = new CMenuForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
|
||||||
mf->setHint("", key_settings[KEY_POWER_OFF].hint);
|
mf->setHint("", key_settings[KEY_POWER_OFF].hint);
|
||||||
bindSettings_modes->addItem(mf);
|
bindSettings_modes->addItem(mf);
|
||||||
}
|
}
|
||||||
@@ -381,7 +383,7 @@ void CKeybindSetup::showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist
|
|||||||
bindSettings_chlist->addItem(oj);
|
bindSettings_chlist->addItem(oj);
|
||||||
#endif
|
#endif
|
||||||
for (int i = KEY_PAGE_UP; i <= KEY_CURRENT_TRANSPONDER; i++) {
|
for (int i = KEY_PAGE_UP; i <= KEY_CURRENT_TRANSPONDER; i++) {
|
||||||
CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
|
CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
|
||||||
mf->setHint("", key_settings[i].hint);
|
mf->setHint("", key_settings[i].hint);
|
||||||
bindSettings_chlist->addItem(mf);
|
bindSettings_chlist->addItem(mf);
|
||||||
}
|
}
|
||||||
@@ -396,7 +398,7 @@ void CKeybindSetup::showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap)
|
|||||||
bindSettings_qzap->addIntroItems(LOCALE_KEYBINDINGMENU_QUICKZAP);
|
bindSettings_qzap->addIntroItems(LOCALE_KEYBINDINGMENU_QUICKZAP);
|
||||||
|
|
||||||
for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++) {
|
for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++) {
|
||||||
CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
|
CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
|
||||||
mf->setHint("", key_settings[i].hint);
|
mf->setHint("", key_settings[i].hint);
|
||||||
bindSettings_qzap->addItem(mf);
|
bindSettings_qzap->addItem(mf);
|
||||||
}
|
}
|
||||||
@@ -407,7 +409,7 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye
|
|||||||
bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER);
|
bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER);
|
||||||
|
|
||||||
for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) {
|
for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) {
|
||||||
CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
|
CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]);
|
||||||
mf->setHint("", key_settings[i].hint);
|
mf->setHint("", key_settings[i].hint);
|
||||||
bindSettings_mplayer->addItem(mf);
|
bindSettings_mplayer->addItem(mf);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user