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) <ogoffart@woboq.com>
bb10
Friedemann Kleint 2016-04-18 15:48:21 +02:00
parent cc7cd61909
commit 5fb2dceab4
1 changed files with 3 additions and 0 deletions

View File

@ -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