mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04: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
6 changed files with 11 additions and 8 deletions
|
@ -44,8 +44,6 @@ ChatDialog::ChatDialog(QWidget *parent, Qt::WFlags flags) :
|
||||||
|
|
||||||
ChatDialog::~ChatDialog()
|
ChatDialog::~ChatDialog()
|
||||||
{
|
{
|
||||||
emit dialogClose(this);
|
|
||||||
|
|
||||||
std::map<std::string, ChatDialog *>::iterator it;
|
std::map<std::string, ChatDialog *>::iterator it;
|
||||||
if (chatDialogs.end() != (it = chatDialogs.find(getPeerId()))) {
|
if (chatDialogs.end() != (it = chatDialogs.find(getPeerId()))) {
|
||||||
chatDialogs.erase(it);
|
chatDialogs.erase(it);
|
||||||
|
|
|
@ -64,7 +64,6 @@ public:
|
||||||
void focusDialog();
|
void focusDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dialogClose(ChatDialog *dialog);
|
|
||||||
void infoChanged(ChatDialog *dialog);
|
void infoChanged(ChatDialog *dialog);
|
||||||
void newMessage(ChatDialog *dialog);
|
void newMessage(ChatDialog *dialog);
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,8 @@ void ChatTabWidget::tabClose(int tab)
|
||||||
|
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
if (dialog->canClose()) {
|
if (dialog->canClose()) {
|
||||||
|
removeDialog(dialog);
|
||||||
|
emit tabClosed(dialog);
|
||||||
dialog->deleteLater();
|
dialog->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tabChanged(ChatDialog *dialog);
|
void tabChanged(ChatDialog *dialog);
|
||||||
|
void tabClosed(ChatDialog *dialog);
|
||||||
void infoChanged();
|
void infoChanged();
|
||||||
|
|
||||||
private slots:
|
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.actionSetOnTop, SIGNAL(toggled(bool)), this, SLOT(setOnTop()));
|
||||||
|
|
||||||
connect(ui.tabWidget, SIGNAL(tabChanged(ChatDialog*)), this, SLOT(tabChanged(ChatDialog*)));
|
connect(ui.tabWidget, SIGNAL(tabChanged(ChatDialog*)), this, SLOT(tabChanged(ChatDialog*)));
|
||||||
|
connect(ui.tabWidget, SIGNAL(tabClosed(ChatDialog*)), this, SLOT(tabClosed(ChatDialog*)));
|
||||||
|
|
||||||
if (tabbedWindow) {
|
if (tabbedWindow) {
|
||||||
/* signal toggled is called */
|
/* 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(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
|
||||||
QObject::connect(dialog, SIGNAL(newMessage(ChatDialog*)), this, SLOT(tabNewMessage(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)
|
void PopupChatWindow::removeDialog(ChatDialog *dialog)
|
||||||
{
|
{
|
||||||
QObject::disconnect(dialog, SIGNAL(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
|
QObject::disconnect(dialog, SIGNAL(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
|
||||||
QObject::disconnect(dialog, SIGNAL(newMessage(ChatDialog*)), this, SLOT(tabNewMessage(ChatDialog*)));
|
QObject::disconnect(dialog, SIGNAL(newMessage(ChatDialog*)), this, SLOT(tabNewMessage(ChatDialog*)));
|
||||||
QObject::disconnect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
|
||||||
|
|
||||||
if (tabbedWindow) {
|
if (tabbedWindow) {
|
||||||
ui.tabWidget->removeDialog(dialog);
|
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)
|
void PopupChatWindow::tabChanged(ChatDialog *dialog)
|
||||||
|
|
|
@ -56,7 +56,7 @@ private slots:
|
||||||
void tabChanged(ChatDialog *dialog);
|
void tabChanged(ChatDialog *dialog);
|
||||||
void tabInfoChanged(ChatDialog *dialog);
|
void tabInfoChanged(ChatDialog *dialog);
|
||||||
void tabNewMessage(ChatDialog *dialog);
|
void tabNewMessage(ChatDialog *dialog);
|
||||||
void dialogClose(ChatDialog *dialog);
|
void tabClosed(ChatDialog *dialog);
|
||||||
void dockTab();
|
void dockTab();
|
||||||
void undockTab();
|
void undockTab();
|
||||||
void setStyle();
|
void setStyle();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue