Fix the crash in Konsole with Qt 4.5.

The problem is that ViewContainer is a QObject and is not aware that one of its QWidget member can die because the ViewContainer is not part of the "GUI" hierarchy. So when you delete the main window it will first delete all QWidgets and then all QObjects, so in our case all GUI objects and then ViewContainer. But since ViewContainer react to destroyed signal of some GUI object and use it that explain the crash. Having QPointer is the easy to way to be aware if one of the member die because the GUI has been deleted.

BUG:170052
BUG:179845

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=907272
This commit is contained in:
Alexis Ménard
2009-01-07 19:25:32 +00:00
parent b986ccbac4
commit fed1626302
2 changed files with 15 additions and 5 deletions

View File

@@ -487,9 +487,13 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position , QObject*
_containerWidget->setLayout(_layout);
}
void TabbedViewContainer::setNewViewMenu(QMenu* menu)
{ _newTabButton->setDelayedMenu(menu); }
{
_newTabButton->setDelayedMenu(menu);
}
ViewContainer::Features TabbedViewContainer::supportedFeatures() const
{ return QuickNewView|QuickCloseView; }
{
return QuickNewView|QuickCloseView;
}
void TabbedViewContainer::setFeatures(Features features)
{
ViewContainer::setFeatures(features);
@@ -695,6 +699,8 @@ void TabbedViewContainer::addViewWidget( QWidget* view , int index)
}
void TabbedViewContainer::removeViewWidget( QWidget* view )
{
if (!_stackWidget)
return;
const int index = _stackWidget->indexOf(view);
Q_ASSERT( index != -1 );
@@ -802,6 +808,8 @@ void StackedViewContainer::addViewWidget( QWidget* view , int )
}
void StackedViewContainer::removeViewWidget( QWidget* view )
{
if (!_stackWidget)
return;
const int index = _stackWidget->indexOf(view);
Q_ASSERT( index != -1);
@@ -897,6 +905,8 @@ void ListViewContainer::addViewWidget( QWidget* view , int )
void ListViewContainer::removeViewWidget( QWidget* view )
{
if (!_stackWidget)
return;
int index = _stackWidget->indexOf(view);
_stackWidget->removeWidget(view);
delete _listWidget->takeItem( index );