From 7abd1a8f699de9688c859f169a2827b2dcbbe2d3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Jun 2019 20:44:57 +0200 Subject: [PATCH] moviebrowser: fix possible memleaks with initOptionsBrowserMenu() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cdd74b24de6b4320e5cb0b9fd3712adf9cbac792 Author: Thilo Graf Date: 2019-06-25 (Tue, 25 Jun 2019) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/moviebrowser/mb.cpp | 29 ++++++++++++++--------------- src/gui/moviebrowser/mb.h | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 82aa22720..b95b775c7 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -3631,23 +3631,15 @@ void CMovieBrowser::initOptionsDirMenu(CMenuWidget *OptionsMenuDir, std::vector< } } -void CMovieBrowser::initOptionsBrowserMenu(CMenuWidget *OptionsMenuBrowser) +void CMovieBrowser::initOptionsBrowserMenu(CMenuWidget *OptionsMenuBrowser, CIntInput* PlayMaxUserIntInput, CIntInput* RecMaxUserIntInput, CIntInput* BrowserFrameUserIntInputAdd, CIntInput* BrowserFrameUserIntInputGen, CIntInput* BrowserRowNrIntInput) { - CIntInput* playMaxUserIntInput = new CIntInput(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, (int *)&m_settings.lastPlayMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - CIntInput* recMaxUserIntInput = new CIntInput(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, (int *)&m_settings.lastRecordMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - - CIntInput* browserFrameUserIntInputAdd = new CIntInput(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int *)&m_settings.browserFrameHeightAdditional, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - CIntInput* browserFrameUserIntInputGen = new CIntInput(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int *)&m_settings.browserFrameHeightGeneral, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - - CIntInput* browserRowNrIntInput = new CIntInput(LOCALE_MOVIEBROWSER_BROWSER_ROW_NR, (int *)&m_settings.browserRowNr, 1, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - OptionsMenuBrowser->addIntroItems(LOCALE_MOVIEBROWSER_OPTION_BROWSER); - OptionsMenuBrowser->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, true, playMaxUserIntInput->getValue(), playMaxUserIntInput)); - OptionsMenuBrowser->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, true, recMaxUserIntInput->getValue(), recMaxUserIntInput)); + OptionsMenuBrowser->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, true, PlayMaxUserIntInput->getValue(), PlayMaxUserIntInput)); + OptionsMenuBrowser->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, true, RecMaxUserIntInput->getValue(), RecMaxUserIntInput)); OptionsMenuBrowser->addItem(GenericMenuSeparatorLine); - CMenuForwarder* fw1 = new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, !m_settings.browserAdditional, browserFrameUserIntInputGen->getValue(), browserFrameUserIntInputGen); - CMenuForwarder* fw2 = new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH_ADDITIONAL, m_settings.browserAdditional, browserFrameUserIntInputAdd->getValue(), browserFrameUserIntInputAdd); + CMenuForwarder* fw1 = new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, !m_settings.browserAdditional, BrowserFrameUserIntInputGen->getValue(), BrowserFrameUserIntInputGen); + CMenuForwarder* fw2 = new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH_ADDITIONAL, m_settings.browserAdditional, BrowserFrameUserIntInputAdd->getValue(), BrowserFrameUserIntInputAdd); CMenuOptionChooser *oj = new CMenuOptionChooser(LOCALE_MOVIEBROWSER_BROWSER_ADDITIONAL, (int*)(&m_settings.browserAdditional), MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true); oj->OnAfterChangeOption.connect(sigc::bind(sigc::mem_fun(*this, &CMovieBrowser::changeBrowserHeight), fw1, fw2)); @@ -3659,7 +3651,7 @@ void CMovieBrowser::initOptionsBrowserMenu(CMenuWidget *OptionsMenuBrowser) OptionsMenuBrowser->addItem(GenericMenuSeparatorLine); OptionsMenuBrowser->addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_BROWSER_CUT_LONG_ROWTEXT, (int*)(&m_settings.browserCutLongRowText), MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true)); OptionsMenuBrowser->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MOVIEBROWSER_BROWSER_ROW_HEAD)); - OptionsMenuBrowser->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_ROW_NR, true, browserRowNrIntInput->getValue(), browserRowNrIntInput)); + OptionsMenuBrowser->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BROWSER_ROW_NR, true, BrowserRowNrIntInput->getValue(), BrowserRowNrIntInput)); OptionsMenuBrowser->addItem(GenericMenuSeparator); for (int i = 0; i < MB_MAX_ROWS; i++) { @@ -3693,7 +3685,14 @@ bool CMovieBrowser::showMenu(bool calledExternally) int oldFrameHeight = m_settings.browserFrameHeight; int oldAdditional = m_settings.browserAdditional; CMenuWidget optionsMenuBrowser(LOCALE_MOVIEBROWSER_HEAD, NEUTRINO_ICON_MOVIEPLAYER); - initOptionsBrowserMenu(&optionsMenuBrowser); + CIntInput playMaxUserIntInput(LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, (int *)&m_settings.lastPlayMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + CIntInput recMaxUserIntInput(LOCALE_MOVIEBROWSER_LAST_RECORD_MAX_ITEMS, (int *)&m_settings.lastRecordMaxItems, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + + CIntInput browserFrameUserIntInputAdd(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int *)&m_settings.browserFrameHeightAdditional, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + CIntInput browserFrameUserIntInputGen(LOCALE_MOVIEBROWSER_BROWSER_FRAME_HIGH, (int *)&m_settings.browserFrameHeightGeneral, 3, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + + CIntInput browserRowNrIntInput(LOCALE_MOVIEBROWSER_BROWSER_ROW_NR, (int *)&m_settings.browserRowNr, 1, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + initOptionsBrowserMenu(&optionsMenuBrowser, &playMaxUserIntInput, &recMaxUserIntInput, &browserFrameUserIntInputAdd, &browserFrameUserIntInputGen, &browserRowNrIntInput); /********************************************************************/ /** options **************************************************/ diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index 85341bd42..a1bf9d869 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -353,7 +353,7 @@ class CMovieBrowser : public CMenuTarget, public CProgressSignals void initUpdateMovieInfoMenu(CMenuWidget *MovieInfoMenuUpdate); void initParentalMenu(CMenuWidget *ParentalMenu); void initOptionsDirMenu(CMenuWidget *OptionsMenuDir, std::vector& v_notifiers); - void initOptionsBrowserMenu(CMenuWidget *OptionsMenuBrowser); + void initOptionsBrowserMenu(CMenuWidget *OptionsMenuBrowser, CIntInput* PlayMaxUserIntInput, CIntInput* RecMaxUserIntInput, CIntInput* BrowserFrameUserIntInputAdd, CIntInput* BrowserFrameUserIntInputGen, CIntInput* BrowserRowNrIntInput); int showMovieInfoMenu(MI_MOVIE_INFO* movie_info); // P2 int showMovieCutMenu(); // P2 int showStartPosSelectionMenu(void); // P2