Memory leak fix

Instantiate the smiley pop-up window (and all its buttons) only once.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2890 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
leander-256 2010-05-12 19:03:30 +00:00
parent 988c6c31f5
commit faace1f322
2 changed files with 59 additions and 54 deletions

View File

@ -96,7 +96,8 @@
/** Constructor */
PeersDialog::PeersDialog(QWidget *parent)
: RsAutoUpdatePage(1500,parent),
historyKeeper(Rshare::dataDirectory() + "/his1.xml")
historyKeeper(Rshare::dataDirectory() + "/his1.xml"),
smWidget(0)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
@ -238,6 +239,7 @@ PeersDialog::~PeersDialog ()
delete (it->second);
}
}
delete smWidget;
}
void PeersDialog::pasteLink()
@ -1403,7 +1405,8 @@ void PeersDialog::loadEmoticonsgroupchat()
void PeersDialog::smileyWidgetgroupchat()
{
qDebug("MainWindow::smileyWidget()");
QWidget *smWidget = new QWidget(this , Qt::Popup );
if(smWidget == 0) {
smWidget = new QWidget(this , Qt::Popup );
smWidget->setWindowTitle("Emoticons");
smWidget->setWindowIcon(QIcon(QString(":/images/rstray3.png")));
//smWidget->setFixedSize(256,256);
@ -1463,6 +1466,7 @@ void PeersDialog::smileyWidgetgroupchat()
connect(smButton, SIGNAL(clicked()), this, SLOT(addSmileys()));
connect(smButton, SIGNAL(clicked()), smWidget, SLOT(close()));
}
}
smWidget->show();
}

View File

@ -194,6 +194,7 @@ private:
time_t last_status_send_time ;
QHash<QString, QString> smileys;
QWidget *smWidget;
std::map<std::string, PopupChatDialog *> chatDialogs;