don't crash when removing the currently active tab
will backport to 4.2 svn path=/trunk/KDE/kdelibs/; revision=916689
This commit is contained in:
parent
21144164ff
commit
d0fb10f0cc
@ -360,18 +360,23 @@ void TabBar::removeTab(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
int currentIndex = d->tabProxy->native->currentIndex();
|
||||
|
||||
int oldCurrentIndex = d->tabProxy->native->currentIndex();
|
||||
d->tabProxy->native->removeTab(index);
|
||||
QGraphicsWidget *page = d->pages.takeAt(index);
|
||||
|
||||
if (index == currentIndex) {
|
||||
setCurrentIndex(currentIndex);
|
||||
int currentIndex = d->tabProxy->native->currentIndex();
|
||||
|
||||
if (oldCurrentIndex == index) {
|
||||
d->tabWidgetLayout->removeAt(1);
|
||||
}
|
||||
|
||||
scene()->removeItem(page);
|
||||
page->deleteLater();
|
||||
|
||||
if (oldCurrentIndex != currentIndex) {
|
||||
setCurrentIndex(currentIndex);
|
||||
}
|
||||
|
||||
d->updateTabWidgetMode();
|
||||
d->tabProxy->setPreferredSize(d->tabProxy->native->sizeHint());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user