summaryrefslogtreecommitdiffstats
path: root/src/gui/s60framework
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-10-05 13:56:57 (GMT)
committeraxis <qt-info@nokia.com>2009-10-05 14:32:02 (GMT)
commitc4571223a0ebb2f00a6c29477d0a4a55ae3cd2b5 (patch)
tree666d1aa77474a875dee0e12c86256a36c0ea2db7 /src/gui/s60framework
parent4754ebccb9848bff1cb11caab61f58ac2f441b3c (diff)
downloadQt-c4571223a0ebb2f00a6c29477d0a4a55ae3cd2b5.zip
Qt-c4571223a0ebb2f00a6c29477d0a4a55ae3cd2b5.tar.gz
Qt-c4571223a0ebb2f00a6c29477d0a4a55ae3cd2b5.tar.bz2
Fixed a crash in menus on Symbian.
The reason for the crash was the following: When we make menu entries in Qt, we assign each item an arbitrary command ID. This is because Symbian usually puts the items in a resource file and refers to them by ID, but we need to be dynamic. These command IDs are also assigned to cascading menu items (sub menus). When we then get a callback in RestoreMenuL with one of submenu IDs, we used to ask Symbian to construct the menu items for them, but Symbian doesn't know about them. Fixed by avoiding call into S60 code if the ID belongs to Qt. Also put a cap on the number of menu items. It's very unlikely that anyone will reach it, but it's better to have an actual check. Task: QT-646 AutoTest: Manual testing went fine RevBy: mread
Diffstat (limited to 'src/gui/s60framework')
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index 9e2333b..d8181f8 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -51,7 +51,9 @@
#include "qs60mainappui.h"
#include <QtGui/qapplication.h>
#include <QtGui/qmenu.h>
-#include <QtGui/private/qt_s60_p.h>
+#include <private/qmenu_p.h>
+#include <private/qt_s60_p.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -226,17 +228,14 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane)
*/
void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType)
{
- if ((resourceId == R_QT_WRAPPERAPP_MENUBAR) || (resourceId == R_AVKON_MENUPANE_FEP_DEFAULT)) {
- TResourceReader reader;
- iCoeEnv->CreateResourceReaderLC(reader, resourceId);
- menuWindow->ConstructFromResourceL(reader);
- CleanupStack::PopAndDestroy();
+ if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) {
+ if (menuType == EMenuPane)
+ DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow);
+ else
+ DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow);
+ } else {
+ CAknAppUi::RestoreMenuL(menuWindow, resourceId, menuType);
}
-
- if (menuType == EMenuPane)
- DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow);
- else
- DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow);
}
QT_END_NAMESPACE