From 1a97bc5091f8b302940b7cc8eb1dbb55c3411d64 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 12 Jun 2009 21:05:17 +0200 Subject: 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. --- src/gui/widgets/qmenu_symbian.cpp | 4 ++-- 1 file 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 symbianMenus; static QList nativeMenuBars; static uint qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; -static QWidget* widgetWithContextMenu=0; +static QPointer widgetWithContextMenu; static QList 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); } -- cgit v0.12