From b69a99f74c88e098ca107624265206d8d04220b8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 22:49:07 +0100 Subject: [PATCH] CHDDMenuHandler: simplify and fix hintbox calls Hints were not closed after lost scope. Explicit hide() is required. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/74473d0ebe1976cbc98ae713b10e8630bdbad01a Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) ------------------ This commit was generated by Migit --- src/gui/hdd_menu.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index dcb79167e..8205ddae9 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -336,8 +336,8 @@ bool CHDDMenuHandler::waitfordev(std::string dev, int maxwait) void CHDDMenuHandler::showHint(std::string &message) { - CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, message.c_str()); - hintBox->paint(); + CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, message.c_str()); + hintBox.paint(); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(3); neutrino_msg_t msg; @@ -355,7 +355,7 @@ void CHDDMenuHandler::showHint(std::string &message) else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) break; } - delete hintBox; + hintBox.hide(); } void CHDDMenuHandler::setRecordPath(std::string &dev) @@ -482,8 +482,8 @@ int CHDDMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) if (actionkey[0] == 'm') { for (std::vector::iterator it = hdd_list.begin(); it != hdd_list.end(); ++it) { if (it->devname == dev) { - CHintBox * hintbox = new CHintBox(it->mounted ? LOCALE_HDD_UMOUNT : LOCALE_HDD_MOUNT, it->devname.c_str()); - hintbox->paint(); + CHintBox hintbox(it->mounted ? LOCALE_HDD_UMOUNT : LOCALE_HDD_MOUNT, it->devname.c_str()); + hintbox.paint(); if (it->mounted) umount_dev(it->devname); else @@ -491,7 +491,7 @@ int CHDDMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) it->mounted = is_mounted(it->devname.c_str()); it->cmf->setOption(it->mounted ? umount : mount); - delete hintbox; + hintbox.hide(); return menu_return::RETURN_REPAINT; } }