summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp7
-rw-r--r--tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp10
2 files changed, 14 insertions, 3 deletions
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index f08689cb9b..497bc52109 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -778,15 +778,16 @@ void QToolButtonPrivate::popupTimerDone()
actualMenu->d_func()->causedPopup.action = defaultAction;
actionsCopy = q->actions(); //(the list of action may be modified in slots)
actualMenu->exec(p);
+
+ if (!that)
+ return;
+
QObject::disconnect(actualMenu, SIGNAL(aboutToHide()), q, SLOT(_q_updateButtonDown()));
if (mustDeleteActualMenu)
delete actualMenu;
else
QObject::disconnect(actualMenu, SIGNAL(triggered(QAction*)), q, SLOT(_q_menuTriggered(QAction*)));
- if (!that)
- return;
-
actionsCopy.clear();
if (repeat)
diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
index cebd4883a4..aaff322c4b 100644
--- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
@@ -63,6 +63,7 @@ private slots:
void collapseTextOnPriority();
void task230994_iconSize();
void task176137_autoRepeatOfAction();
+ void qtbug_26956_popupTimerDone();
protected slots:
void sendMouseClick();
@@ -223,5 +224,14 @@ void tst_QToolButton::sendMouseClick()
QTest::mouseClick(w, Qt::LeftButton, 0, QPoint(7,7));
}
+void tst_QToolButton::qtbug_26956_popupTimerDone()
+{
+ QToolButton *tb = new QToolButton;
+ tb->setMenu(new QMenu(tb));
+ tb->menu()->addAction("Qt");
+ tb->deleteLater();
+ tb->showMenu();
+}
+
QTEST_MAIN(tst_QToolButton)
#include "tst_qtoolbutton.moc"