From 767dcf46d8f254bf7443f796a2fbc46616613d8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Mon, 25 Jul 2011 16:26:20 +0300 Subject: [PATCH] Menu no longer crashes randomly Moved the unpausing to be handled by each menu item themselves. Now unpauses only after restart game and restart level. Mysterios crashes caused by the former unpause if condition thus gone. --- seascene.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/seascene.cpp b/seascene.cpp index aa5f91f..d714baf 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -407,17 +407,27 @@ void SeaScene::handleScreenTapped() QGraphicsItem* pItem = items.at(0); //Selecting an item brings here, thus only selecting one item should be possible //... so we can just take the first one + //Selection is just used to get notice of a menu item being clicked, removed after use + + clearSelection(); + + + //Act upon the selected item + if (pItem == pRestartGameItem_) { qDebug() << "game restart requested"; restartGame(); + pPauseAction_->setChecked(false); //unpause game + } else if (pItem == pRestartLevelItem_) { qDebug() << "Level restart requested"; restartLevel(); + pPauseAction_->setChecked(false); //unpause game } @@ -450,20 +460,6 @@ void SeaScene::handleScreenTapped() { qApp->quit(); } - - - - //Selection is just used to get notice of a menu item being clicked, removed after use - - clearSelection(); - - //The user propably went to paused state just to access menu, so unpause unless vibration set (so the user sees its changed) - //or unless status bar was requested - if (pItem != pMinimizeItem_ || pItem != pSettingsItem_) - - { - pPauseAction_->setChecked(false); - } } -- 1.7.9.5