From 5fb2dceab46ede44346a192a9f270b2bb002b5a5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Apr 2016 15:48:21 +0200 Subject: QTabBar: Fix crash when the tab being dragged is deleted programmatically. Call QTabBarPrivate::moveTabFinished() from QTabBar::removeTab() to cancel any drag in progress to prevent crashes due to invalidated indexes. Task-number: QTBUG-52527 Change-Id: I5bd8cc6f55e5aea1f1a4710494ba5b92939a42ee Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qtabbar.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets/widgets/qtabbar.cpp') diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 2ac08ffdcd..87fb3357d6 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -897,6 +897,9 @@ void QTabBar::removeTab(int index) { Q_D(QTabBar); if (d->validIndex(index)) { + if (d->dragInProgress) + d->moveTabFinished(d->pressedIndex); + #ifndef QT_NO_SHORTCUT releaseShortcut(d->tabList.at(index).shortcutId); #endif -- cgit v1.2.3