mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
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:
parent
5a5c0264d0
commit
a3a0690cb4
@ -44,8 +44,6 @@ ChatDialog::ChatDialog(QWidget *parent, Qt::WFlags flags) :
|
||||
|
||||
ChatDialog::~ChatDialog()
|
||||
{
|
||||
emit dialogClose(this);
|
||||
|
||||
std::map<std::string, ChatDialog *>::iterator it;
|
||||
if (chatDialogs.end() != (it = chatDialogs.find(getPeerId()))) {
|
||||
chatDialogs.erase(it);
|
||||
|
@ -64,7 +64,6 @@ public:
|
||||
void focusDialog();
|
||||
|
||||
signals:
|
||||
void dialogClose(ChatDialog *dialog);
|
||||
void infoChanged(ChatDialog *dialog);
|
||||
void newMessage(ChatDialog *dialog);
|
||||
|
||||
|
@ -71,6 +71,8 @@ void ChatTabWidget::tabClose(int tab)
|
||||
|
||||
if (dialog) {
|
||||
if (dialog->canClose()) {
|
||||
removeDialog(dialog);
|
||||
emit tabClosed(dialog);
|
||||
dialog->deleteLater();
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
|
||||
signals:
|
||||
void tabChanged(ChatDialog *dialog);
|
||||
void tabClosed(ChatDialog *dialog);
|
||||
void infoChanged();
|
||||
|
||||
private slots:
|
||||
|
@ -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)
|
||||
|
@ -56,7 +56,7 @@ private slots:
|
||||
void tabChanged(ChatDialog *dialog);
|
||||
void tabInfoChanged(ChatDialog *dialog);
|
||||
void tabNewMessage(ChatDialog *dialog);
|
||||
void dialogClose(ChatDialog *dialog);
|
||||
void tabClosed(ChatDialog *dialog);
|
||||
void dockTab();
|
||||
void undockTab();
|
||||
void setStyle();
|
||||
|
Loading…
Reference in New Issue
Block a user