From a79d2a8e53d6c00c18a9f489c4b74f735977a7ef Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 5 Dec 2010 22:27:50 +0000 Subject: [PATCH] Fixed memory leak in online toaster. The avatar data was not deleted, when the online toaster is deaktivated. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3897 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/notifyqt.cpp | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index 5edec87a3..dd41a5791 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -422,21 +422,19 @@ void NotifyQt::UpdateGUI() { OnlineToaster * onlineToaster = new OnlineToaster(); onlineToaster->setMessage(QString::fromStdString(realmsg)); - - if(size != 0) - { - // set the image - QPixmap pix ; - pix.loadFromData(data,size,"PNG") ; - onlineToaster->setPixmap(pix); - delete[] data ; - } - else - { - onlineToaster->setPixmap(QPixmap(":/images/user/personal64.png")); - } - + if(size != 0) + { + // set the image + QPixmap pix ; + pix.loadFromData(data,size,"PNG") ; + onlineToaster->setPixmap(pix); + } + else + { + onlineToaster->setPixmap(QPixmap(":/images/user/personal64.png")); + } + onlineToaster->show(); onlineToaster->play(); } @@ -449,6 +447,10 @@ void NotifyQt::UpdateGUI() } break; } + + if (data) { + delete[] data; + } } if (rsNotify->NotifySysMessage(sysid, type, title, msg))