summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtabbar
diff options
context:
space:
mode:
authorFrank Reininghaus <frank78ac@googlemail.com>2009-08-26 18:49:32 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-27 08:01:08 (GMT)
commit8ac7e812604d24fcbf28132a611d3b3e06120349 (patch)
tree82051d86764e6483815654e9ddfb2ecf58831c8d /tests/auto/qtabbar
parent4de2a2241e9e1c5f29223d6bd0616e6db77be70e (diff)
downloadQt-8ac7e812604d24fcbf28132a611d3b3e06120349.zip
Qt-8ac7e812604d24fcbf28132a611d3b3e06120349.tar.gz
Qt-8ac7e812604d24fcbf28132a611d3b3e06120349.tar.bz2
Do not crash when double-clicking a tab in a QTabBar with movable tabs
Check if QTabBarPrivate's movingTab member is 0 before dereferencing it. This fixes a crash when double-clicking a tab. New unit test included. http://bugs.kde.org/show_bug.cgi?id=202767 Reviewed-by: Olivier Goffart <ogoffart@trolltech.com> Merge-Request: 1337
Diffstat (limited to 'tests/auto/qtabbar')
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index 041836c..3f77b7a 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -94,6 +94,7 @@ private slots:
void moveTab();
void task251184_removeTab();
+ void changeTitleWhileDoubleClickingTab();
};
// Testing get/set functions
@@ -535,5 +536,38 @@ void tst_QTabBar::task251184_removeTab()
}
+class TitleChangeTabBar : public QTabBar
+{
+ Q_OBJECT
+
+ QTimer timer;
+ int count;
+
+public:
+ TitleChangeTabBar(QWidget * parent = 0) : QTabBar(parent), count(0)
+ {
+ setMovable(true);
+ addTab("0");
+ connect(&timer, SIGNAL(timeout()), this, SLOT(updateTabText()));
+ timer.start(1);
+ }
+
+public slots:
+ void updateTabText()
+ {
+ count++;
+ setTabText(0, QString("%1").arg(count));
+ }
+};
+
+void tst_QTabBar::changeTitleWhileDoubleClickingTab()
+{
+ TitleChangeTabBar bar;
+ QPoint tabPos = bar.tabRect(0).center();
+
+ for(int i=0; i < 10; i++)
+ QTest::mouseDClick(&bar, Qt::LeftButton, 0, tabPos);
+}
+
QTEST_MAIN(tst_QTabBar)
#include "tst_qtabbar.moc"