From f3dab146f231398455e52ff99d4c6f8365c8d412 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 18 Feb 2010 16:07:27 +0100 Subject: Do not reset state too early on RMB click When long-tapping on a spin box, a context menu event would stop incrementing the spin box since we called reset() too early. Call reset only if it's clear that there's a context menu. Also don't crash if menu is 0. Reviewed-by: Robert Griebl --- src/gui/widgets/qabstractspinbox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 4a6235c..7e2f20d 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -1248,8 +1248,11 @@ void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event) #else Q_D(QAbstractSpinBox); - d->reset(); QPointer menu = d->edit->createStandardContextMenu(); + if (!menu) + return; + + d->reset(); QAction *selAll = new QAction(tr("&Select All"), menu); menu->insertAction(d->edit->d_func()->selectAllAction, -- cgit v0.12