Potential fix for sporadic crash when selecting 'Close current tab' option when closing a window. Extract method for disconnecting a controller in the main window and call it in queryClose() before closing the plugged controller's session.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=761925
This commit is contained in:
Robert Knight
2008-01-15 17:37:44 +00:00
parent bfa9e52acd
commit 04a2943128
2 changed files with 16 additions and 11 deletions

View File

@@ -129,6 +129,14 @@ ViewManager* MainWindow::viewManager() const
return _viewManager;
}
void MainWindow::disconnectController(SessionController* controller)
{
disconnect( controller , SIGNAL(titleChanged(ViewProperties*))
, this , SLOT(activeViewTitleChanged(ViewProperties*)) );
guiFactory()->removeClient(controller);
controller->setSearchBar(0);
}
void MainWindow::activeViewChanged(SessionController* controller)
{
// associate bookmark menu with current session
@@ -137,15 +145,8 @@ void MainWindow::activeViewChanged(SessionController* controller)
connect( bookmarkHandler() , SIGNAL(openUrl(const KUrl&)) , controller ,
SLOT(openUrl(const KUrl&)) );
// disconnect existing controller's UI
if ( _pluggedController )
{
disconnect( _pluggedController , SIGNAL(titleChanged(ViewProperties*))
, this , SLOT(activeViewTitleChanged(ViewProperties*)) );
guiFactory()->removeClient(_pluggedController);
_pluggedController->setSearchBar(0);
}
disconnectController(_pluggedController);
// listen for title changes from the current session
Q_ASSERT( controller );
@@ -320,8 +321,11 @@ bool MainWindow::queryClose()
case KMessageBox::Yes:
return true;
case KMessageBox::No:
if (_pluggedController && _pluggedController->session())
_pluggedController->session()->close();
if (_pluggedController && _pluggedController->session())
{
disconnectController(_pluggedController);
_pluggedController->session()->close();
}
return false;
case KMessageBox::Cancel:
return false;