Fixed crash when closing a chat window.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4849 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-01-26 21:30:57 +00:00
parent 5a5c0264d0
commit a3a0690cb4
6 changed files with 11 additions and 8 deletions

View file

@ -89,6 +89,7 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WFlags flags)
connect(ui.actionSetOnTop, SIGNAL(toggled(bool)), this, SLOT(setOnTop()));
connect(ui.tabWidget, SIGNAL(tabChanged(ChatDialog*)), this, SLOT(tabChanged(ChatDialog*)));
connect(ui.tabWidget, SIGNAL(tabClosed(ChatDialog*)), this, SLOT(tabClosed(ChatDialog*)));
if (tabbedWindow) {
/* signal toggled is called */
@ -163,14 +164,12 @@ void PopupChatWindow::addDialog(ChatDialog *dialog)
QObject::connect(dialog, SIGNAL(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
QObject::connect(dialog, SIGNAL(newMessage(ChatDialog*)), this, SLOT(tabNewMessage(ChatDialog*)));
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
}
void PopupChatWindow::removeDialog(ChatDialog *dialog)
{
QObject::disconnect(dialog, SIGNAL(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
QObject::disconnect(dialog, SIGNAL(newMessage(ChatDialog*)), this, SLOT(tabNewMessage(ChatDialog*)));
QObject::disconnect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
if (tabbedWindow) {
ui.tabWidget->removeDialog(dialog);
@ -272,9 +271,13 @@ void PopupChatWindow::getAvatar()
}
}
void PopupChatWindow::dialogClose(ChatDialog *dialog)
void PopupChatWindow::tabClosed(ChatDialog *dialog)
{
removeDialog(dialog);
if (tabbedWindow) {
if (ui.tabWidget->count() == 0) {
deleteLater();
}
}
}
void PopupChatWindow::tabChanged(ChatDialog *dialog)