From 321f7c3419099d824c18a6b2b82b7e69bd60716e Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 27 Aug 2012 21:29:04 +0200 Subject: [PATCH] fix an infinite recursion regression on several dialogs. --- apps/openmw/mwgui/birth.cpp | 2 +- apps/openmw/mwgui/birth.hpp | 2 +- apps/openmw/mwgui/charactercreation.cpp | 18 +++++++++--------- apps/openmw/mwgui/class.cpp | 12 ------------ apps/openmw/mwgui/class.hpp | 7 ++----- apps/openmw/mwgui/journalwindow.hpp | 2 +- apps/openmw/mwgui/race.cpp | 1 - apps/openmw/mwgui/race.hpp | 2 +- apps/openmw/mwgui/review.cpp | 1 - apps/openmw/mwgui/review.hpp | 2 +- apps/openmw/mwgui/text_input.cpp | 1 - apps/openmw/mwgui/text_input.hpp | 2 +- apps/openmw/mwgui/windowmanagerimp.cpp | 1 - 13 files changed, 17 insertions(+), 36 deletions(-) diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index 05a337cbc..1a5c2d0f6 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -65,9 +65,9 @@ void BirthDialog::setNextButtonShow(bool shown) void BirthDialog::open() { + WindowBase::open(); updateBirths(); updateSpells(); - setVisible(true); } diff --git a/apps/openmw/mwgui/birth.hpp b/apps/openmw/mwgui/birth.hpp index 92665081d..5bd36e828 100644 --- a/apps/openmw/mwgui/birth.hpp +++ b/apps/openmw/mwgui/birth.hpp @@ -28,7 +28,7 @@ namespace MWGui void setBirthId(const std::string &raceId); void setNextButtonShow(bool shown); - void open(); + virtual void open(); // Events typedef delegates::CMultiDelegate0 EventHandle_Void; diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index 8c82b3e43..7d63f6922 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -194,7 +194,7 @@ void CharacterCreation::spawnDialog(const char id) mNameDialog->setTextInput(mPlayerName); mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen); mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone); - mNameDialog->open(); + mNameDialog->setVisible(true); break; case GM_Race: @@ -205,7 +205,7 @@ void CharacterCreation::spawnDialog(const char id) mRaceDialog->setRaceId(mPlayerRaceId); mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone); mRaceDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogBack); - mRaceDialog->open(); + mRaceDialog->setVisible(true);; break; case GM_Class: @@ -213,7 +213,7 @@ void CharacterCreation::spawnDialog(const char id) mClassChoiceDialog = 0; mClassChoiceDialog = new ClassChoiceDialog(*mWM); mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice); - mClassChoiceDialog->open(); + mClassChoiceDialog->setVisible(true); break; case GM_ClassPick: @@ -224,7 +224,7 @@ void CharacterCreation::spawnDialog(const char id) mPickClassDialog->setClassId(mPlayerClass.name); mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone); mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack); - mPickClassDialog->open(); + mPickClassDialog->setVisible(true); break; case GM_Birth: @@ -234,7 +234,7 @@ void CharacterCreation::spawnDialog(const char id) mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen); mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone); mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack); - mBirthSignDialog->open(); + mBirthSignDialog->setVisible(true); break; case GM_ClassCreate: @@ -244,7 +244,7 @@ void CharacterCreation::spawnDialog(const char id) mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen); mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone); mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack); - mCreateClassDialog->open(); + mCreateClassDialog->setVisible(true); break; case GM_ClassGenerate: mGenerateClassStep = 0; @@ -289,7 +289,7 @@ void CharacterCreation::spawnDialog(const char id) mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone); mReviewDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogBack); mReviewDialog->eventActivateDialog += MyGUI::newDelegate(this, &CharacterCreation::onReviewActivateDialog); - mReviewDialog->open(); + mReviewDialog->setVisible(true); break; } } @@ -680,7 +680,7 @@ void CharacterCreation::showClassQuestionDialog() mGenerateClassResultDialog->setClassId(mGenerateClass); mGenerateClassResultDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassBack); mGenerateClassResultDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassDone); - mGenerateClassResultDialog->open(); + mGenerateClassResultDialog->setVisible(true); return; } @@ -703,7 +703,7 @@ void CharacterCreation::showClassQuestionDialog() buttons.push_back(sGenerateClassSteps[mGenerateClassStep].mButtons[2]); mGenerateClassQuestionDialog->setButtons(buttons); mGenerateClassQuestionDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassQuestionChosen); - mGenerateClassQuestionDialog->open(); + mGenerateClassQuestionDialog->setVisible(true); MWBase::Environment::get().getSoundManager()->say(sGenerateClassSteps[mGenerateClassStep].mSound); } diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index 971740b5e..9ea7b8052 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -46,11 +46,6 @@ GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parW backButton->setCoord(315 - okButtonWidth - backButtonWidth - 6, 219, backButtonWidth, 23); } -void GenerateClassResultDialog::open() -{ - setVisible(true); -} - std::string GenerateClassResultDialog::getClassId() const { return mClassName->getCaption(); @@ -143,7 +138,6 @@ void PickClassDialog::open() { updateClasses(); updateStats(); - setVisible(true); } @@ -341,7 +335,6 @@ void InfoBoxDialog::open() layoutVertically(mMainWidget, 4 + 6); center(); - setVisible(true); } int InfoBoxDialog::getChosenButton() const @@ -549,11 +542,6 @@ void CreateClassDialog::setNextButtonShow(bool shown) descriptionButton->setCoord(459 - okButtonWidth - backButtonWidth - descriptionButtonWidth - 12, 158, descriptionButtonWidth, 23); } -void CreateClassDialog::open() -{ - setVisible(true); -} - // widget controls void CreateClassDialog::onDialogCancel() diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp index bcb5c2627..43511ccca 100644 --- a/apps/openmw/mwgui/class.hpp +++ b/apps/openmw/mwgui/class.hpp @@ -26,7 +26,7 @@ namespace MWGui std::string getText() const; void setButtons(ButtonList &buttons); - void open(); + virtual void open(); int getChosenButton() const; // Events @@ -74,8 +74,6 @@ namespace MWGui std::string getClassId() const; void setClassId(const std::string &classId); - void open(); - // Events typedef delegates::CMultiDelegate0 EventHandle_Void; @@ -104,7 +102,7 @@ namespace MWGui void setClassId(const std::string &classId); void setNextButtonShow(bool shown); - void open(); + virtual void open(); // Events typedef delegates::CMultiDelegate0 EventHandle_Void; @@ -264,7 +262,6 @@ namespace MWGui std::vector getMinorSkills() const; void setNextButtonShow(bool shown); - void open(); // Events typedef delegates::CMultiDelegate0 EventHandle_Void; diff --git a/apps/openmw/mwgui/journalwindow.hpp b/apps/openmw/mwgui/journalwindow.hpp index fc05bbdbc..a62e48803 100644 --- a/apps/openmw/mwgui/journalwindow.hpp +++ b/apps/openmw/mwgui/journalwindow.hpp @@ -14,7 +14,7 @@ namespace MWGui { public: JournalWindow(MWBase::WindowManager& parWindowManager); - void open(); + virtual void open(); virtual void setVisible(bool visible); // only used to play close sound diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index ceb0452fb..a597dcadb 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -113,7 +113,6 @@ void RaceDialog::open() updateRaces(); updateSkills(); updateSpellPowers(); - setVisible(true); } diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 3da6b0ace..2e9e09a3e 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -43,7 +43,7 @@ namespace MWGui // setHair() void setNextButtonShow(bool shown); - void open(); + virtual void open(); // Events typedef delegates::CMultiDelegate0 EventHandle_Void; diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index 8dd894c25..4a9cc778a 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -110,7 +110,6 @@ ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager) void ReviewDialog::open() { updateSkillArea(); - setVisible(true); } void ReviewDialog::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos) diff --git a/apps/openmw/mwgui/review.hpp b/apps/openmw/mwgui/review.hpp index f0bde6ecd..f6d373232 100644 --- a/apps/openmw/mwgui/review.hpp +++ b/apps/openmw/mwgui/review.hpp @@ -46,7 +46,7 @@ namespace MWGui void configureSkills(const SkillList& major, const SkillList& minor); void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat& value); - void open(); + virtual void open(); // Events typedef delegates::CMultiDelegate0 EventHandle_Void; diff --git a/apps/openmw/mwgui/text_input.cpp b/apps/openmw/mwgui/text_input.cpp index 802cd3063..b724bab15 100644 --- a/apps/openmw/mwgui/text_input.cpp +++ b/apps/openmw/mwgui/text_input.cpp @@ -45,7 +45,6 @@ void TextInputDialog::open() { // Make sure the edit box has focus MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit); - setVisible(true); } // widget controls diff --git a/apps/openmw/mwgui/text_input.hpp b/apps/openmw/mwgui/text_input.hpp index 7a3325722..8fb0e5819 100644 --- a/apps/openmw/mwgui/text_input.hpp +++ b/apps/openmw/mwgui/text_input.hpp @@ -25,7 +25,7 @@ namespace MWGui void setNextButtonShow(bool shown); void setTextLabel(const std::string &label); - void open(); + virtual void open(); protected: void onOkClicked(MyGUI::Widget* _sender); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 138349c2e..60a574b3c 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -318,7 +318,6 @@ void WindowManager::updateVisible() break; case GM_Journal: mJournal->setVisible(true); - mJournal->open(); break; default: // Unsupported mode, switch back to game