From ad0c9f35ebd88ad581ebab3b62b9c5eaad920fd8 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 26 Feb 2011 16:22:24 +0000 Subject: [PATCH] neutrino: don't crash during fanspeed setup Dear pupils, this is what we learned in todays: * crashing == bad * not crashing == good * deleting an object and then using it == crash git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1218 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/931c2c2661986489ff5e7664f45975b7277f35e2 Author: Stefan Seyfried Date: 2011-02-26 (Sat, 26 Feb 2011) ------------------ This commit was generated by Migit --- src/gui/miscsettings_menu.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 4df3e1af7..1a64ef385 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -55,6 +55,9 @@ extern CPlugins * g_PluginList; +/* this is ugly, but at least it does not crash */ +CFanControlNotifier *fanNotifier; + CMiscMenue::CMiscMenue() { width = w_max (40, 10); @@ -170,6 +173,7 @@ const CMenuOptionChooser::keyval_ext CPU_FREQ_OPTIONS[CPU_FREQ_OPTION_COUNT] = void CMiscMenue::showMiscSettingsMenu() { //misc settings + fanNotifier = new CFanControlNotifier(); CMenuWidget *misc_menue = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width); misc_menue->setSelected(selected); @@ -221,6 +225,7 @@ void CMiscMenue::showMiscSettingsMenu() misc_menue->exec(NULL, ""); misc_menue->hide(); selected = misc_menue->getSelected(); + delete fanNotifier; delete misc_menue; } @@ -236,11 +241,8 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) //fan speed if (g_info.has_fan) { - CFanControlNotifier *fanNotifier = new CFanControlNotifier(); - //don't show fan speed settings on cable box and NEO ms_general->addItem(new CMenuOptionNumberChooser(LOCALE_FAN_SPEED, &g_settings.fan_speed, true, 1, 14, fanNotifier, 0, 0, LOCALE_OPTIONS_OFF) ); fanNotifier->changeNotify(NONEXISTANT_LOCALE, (void*) &g_settings.fan_speed); - delete fanNotifier; } //rotor