From f50aaa1d2c4842a9a875fe65fc831bc8cbe3d5b5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Jun 2019 22:48:08 +0200 Subject: [PATCH] movibrowser: fix 'clean up showMovieInfoMenu(), bookmark menu outsourced' CIntInput objects has been positioned unfavorable within scope and caused possible crashes. This was not noticeable while compiling. To avoid crashes and possible memleaks some parameters were added for CIntInput objects. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4bab95ba64885c80486203228a19e1d0d29aea7b Author: Thilo Graf Date: 2019-06-16 (Sun, 16 Jun 2019) ------------------ This commit was generated by Migit --- src/gui/moviebrowser/mb.cpp | 20 +++++++++----------- src/gui/moviebrowser/mb.h | 3 ++- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 0770d5adf..2a84b1b52 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -3404,18 +3403,14 @@ void CMovieBrowser::showHelp(void) help.exec(); } -void CMovieBrowser::initBookMarkMenu(CMenuWidget *BookmarkMenu, MI_MOVIE_INFO* movie_info) +void CMovieBrowser::initBookMarkMenu(CMenuWidget *BookmarkMenu, MI_MOVIE_INFO* movie_info, CIntInput* BookStartIntInput, CIntInput* BookLastIntInput, CIntInput* BookEndIntInput) { - CIntInput bookStartIntInput(LOCALE_MOVIEBROWSER_EDIT_BOOK, (int *)&movie_info->bookmarks.start, 5, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO1, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO2); - CIntInput bookLastIntInput(LOCALE_MOVIEBROWSER_EDIT_BOOK, (int *)&movie_info->bookmarks.lastPlayStop, 5, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO1, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO2); - CIntInput bookEndIntInput(LOCALE_MOVIEBROWSER_EDIT_BOOK, (int *)&movie_info->bookmarks.end, 5, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO1, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO2); - BookmarkMenu->addIntroItems(LOCALE_MOVIEBROWSER_BOOK_HEAD); BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_CLEAR_ALL, true, NULL, this, "book_clear_all", CRCInput::RC_red)); BookmarkMenu->addItem(GenericMenuSeparatorLine); - BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIESTART, true, bookStartIntInput.getValue(), &bookStartIntInput)); - BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIEEND, true, bookEndIntInput.getValue(), &bookEndIntInput)); - BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_LASTMOVIESTOP, true, bookLastIntInput.getValue(), &bookLastIntInput)); + BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIESTART, true, BookStartIntInput->getValue(), BookStartIntInput)); + BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_MOVIEEND, true, BookEndIntInput->getValue(), BookEndIntInput)); + BookmarkMenu->addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_LASTMOVIESTOP, true, BookLastIntInput->getValue(), BookLastIntInput)); BookmarkMenu->addItem(GenericMenuSeparatorLine); for (int li =0 ; li < MI_MOVIE_BOOK_USER_MAX && li < MAX_NUMBER_OF_BOOKMARK_ITEMS; li++) @@ -3440,9 +3435,12 @@ void CMovieBrowser::initBookMarkMenu(CMenuWidget *BookmarkMenu, MI_MOVIE_INFO* m #define MAX_STRING 30 int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info) { - // int bookmark menu + // init bookmark menu CMenuWidget bookmarkMenu(LOCALE_MOVIEBROWSER_HEAD, NEUTRINO_ICON_MOVIEPLAYER); - initBookMarkMenu(&bookmarkMenu, movie_info); + CIntInput bookStartIntInput(LOCALE_MOVIEBROWSER_EDIT_BOOK, (int *)&movie_info->bookmarks.start, 5, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO1, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO2); + CIntInput bookLastIntInput(LOCALE_MOVIEBROWSER_EDIT_BOOK, (int *)&movie_info->bookmarks.lastPlayStop, 5, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO1, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO2); + CIntInput bookEndIntInput(LOCALE_MOVIEBROWSER_EDIT_BOOK, (int *)&movie_info->bookmarks.end, 5, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO1, LOCALE_MOVIEBROWSER_EDIT_BOOK_POS_INFO2); + initBookMarkMenu(&bookmarkMenu, movie_info, &bookStartIntInput, &bookLastIntInput, &bookEndIntInput); /********************************************************************/ /** serie******************************************************/ diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index 7498ff0cd..f878ffae2 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -58,6 +58,7 @@ #include #include #include +#include #include #define MAX_NUMBER_OF_BOOKMARK_ITEMS MI_MOVIE_BOOK_USER_MAX // we just use the same size as used in Movie info (MAX_NUMBER_OF_BOOKMARK_ITEMS is used for the number of menu items) @@ -346,7 +347,7 @@ class CMovieBrowser : public CMenuTarget, public CProgressSignals ///// Menu //////////////////////////////////// bool showMenu(bool calledExternally = false); - void initBookMarkMenu(CMenuWidget *BookmarkMenu, MI_MOVIE_INFO* movie_info); + void initBookMarkMenu(CMenuWidget *BookmarkMenu, MI_MOVIE_INFO* movie_info, CIntInput* BookStartIntInput, CIntInput* BookLastIntInput, CIntInput* BookEndIntInput); int showMovieInfoMenu(MI_MOVIE_INFO* movie_info); // P2 int showMovieCutMenu(); // P2 int showStartPosSelectionMenu(void); // P2