summaryrefslogtreecommitdiff
path: root/ui/qt/main_window.cpp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-08-25 14:51:50 +0200
committerStig Bjørlykke <stig@bjorlykke.org>2015-08-27 09:14:29 +0000
commit6151946ffe3c4fc5e1279f0d1c46b2c657792c95 (patch)
tree9a83f6e63c8b7ccd130ce9f1ec00e5c415bff7df /ui/qt/main_window.cpp
parentefba97723543fa424800db151a9dd05af6c24594 (diff)
downloadwireshark-6151946ffe3c4fc5e1279f0d1c46b2c657792c95.tar.gz
Qt: Fixed some memory leakages
Change-Id: I5bccf706001f9ff41197ed13b1be5a7404ca594f Reviewed-on: https://code.wireshark.org/review/10251 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/main_window.cpp')
-rw-r--r--ui/qt/main_window.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 30f3f51792..b5483ce34c 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -155,8 +155,9 @@ simple_message_box(ESD_TYPE_E type, gboolean *notagain,
sd.setDetailedText(secondary_msg);
#if (QT_VERSION > QT_VERSION_CHECK(5, 2, 0))
- QCheckBox *cb = new QCheckBox();
+ QCheckBox *cb = NULL;
if (notagain) {
+ cb = new QCheckBox();
cb->setChecked(true);
cb->setText(QObject::tr("Don't show this message again."));
sd.setCheckBox(cb);
@@ -166,7 +167,7 @@ simple_message_box(ESD_TYPE_E type, gboolean *notagain,
sd.exec();
#if (QT_VERSION > QT_VERSION_CHECK(5, 2, 0))
- if (notagain) {
+ if (notagain && cb) {
*notagain = cb->isChecked();
}
#endif
@@ -674,7 +675,8 @@ void MainWindow::closeEvent(QCloseEvent *event) {
return;
}
- if (!testCaptureFileClose(TRUE, *new QString(" before quitting"))) {
+ QString before_what(tr(" before quitting"));
+ if (!testCaptureFileClose(TRUE, before_what)) {
event->ignore();
return;
}
@@ -967,7 +969,8 @@ void MainWindow::mergeCaptureFile()
void MainWindow::importCaptureFile() {
ImportTextDialog import_dlg;
- if (!testCaptureFileClose(FALSE, *new QString(tr(" before importing a new capture"))))
+ QString before_what(tr(" before importing a new capture"));
+ if (!testCaptureFileClose(FALSE, before_what))
return;
import_dlg.exec();