summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu_symbian.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <aportale@trolltech.com>2009-06-12 19:05:17 (GMT)
committerAlessandro Portale <aportale@trolltech.com>2009-06-12 19:05:17 (GMT)
commit1a97bc5091f8b302940b7cc8eb1dbb55c3411d64 (patch)
tree9ad3d0a4c7119f8e587692d100866f2a7ff47ed0 /src/gui/widgets/qmenu_symbian.cpp
parent43c2996c4ffea74776de26defa277b0a886d15c1 (diff)
downloadQt-1a97bc5091f8b302940b7cc8eb1dbb55c3411d64.zip
Qt-1a97bc5091f8b302940b7cc8eb1dbb55c3411d64.tar.gz
Qt-1a97bc5091f8b302940b7cc8eb1dbb55c3411d64.tar.bz2
Crash fix for task #255989
Hold a QPointer to the widget with the context menu. After the menu pops up, the focussed widget looses focus and may be deleted (like it happens in this case with the item editor). Testing for isNull() instead of crashing. It would be great to not even add the "Action" entry to the system menu but in that moment we don't know that the current focuswidget will soon disappear. That's still a Todo.
Diffstat (limited to 'src/gui/widgets/qmenu_symbian.cpp')
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index c7b117e..8983a50 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -74,7 +74,7 @@ struct SymbianMenuItem
static QList<SymbianMenuItem*> symbianMenus;
static QList<QMenuBar*> nativeMenuBars;
static uint qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM;
-static QWidget* widgetWithContextMenu=0;
+static QPointer<QWidget> widgetWithContextMenu;
static QList<QAction*> contextMenuActionList;
static QAction contextAction(0);
static int contexMenuCommand=0;
@@ -254,7 +254,7 @@ Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id)
void QMenuBarPrivate::symbianCommands(int command)
{
- if (command == contexMenuCommand) {
+ if (command == contexMenuCommand && !widgetWithContextMenu.isNull()) {
QContextMenuEvent* event = new QContextMenuEvent(QContextMenuEvent::Keyboard, QPoint(0,0));
QCoreApplication::postEvent(widgetWithContextMenu, event);
}