summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Griebl <rgriebl@trolltech.com>2010-03-03 16:25:07 (GMT)
committerRobert Griebl <rgriebl@trolltech.com>2010-03-03 16:26:40 (GMT)
commitc7f2181a25243ed07f1406c7023dfdd5fb75d77d (patch)
treef969ba6296fa6eb597140c975082934f33d07911
parentb489394e695f78d78db9bf08bc985219f8fb9bb2 (diff)
downloadQt-c7f2181a25243ed07f1406c7023dfdd5fb75d77d.zip
Qt-c7f2181a25243ed07f1406c7023dfdd5fb75d77d.tar.gz
Qt-c7f2181a25243ed07f1406c7023dfdd5fb75d77d.tar.bz2
Make sure not to crash if createStandardContextMenu() returns 0 (e.g. on Maemo5)
Reviewed-by: Harald Fernengel
-rw-r--r--src/gui/widgets/qlineedit.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 0ba8b9f..595f552 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -2038,9 +2038,10 @@ void QLineEdit::dropEvent(QDropEvent* e)
*/
void QLineEdit::contextMenuEvent(QContextMenuEvent *event)
{
- QMenu *menu = createStandardContextMenu();
- menu->setAttribute(Qt::WA_DeleteOnClose);
- menu->popup(event->globalPos());
+ if (QMenu *menu = createStandardContextMenu()) {
+ menu->setAttribute(Qt::WA_DeleteOnClose);
+ menu->popup(event->globalPos());
+ }
}
#if defined(Q_WS_WIN)