diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-07-24 10:24:15 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-07-24 20:03:28 +0000 |
commit | 7be155ee1ec61166bdf1a525902c05b378c75b66 (patch) | |
tree | cff6e59d65849227272d850e3c800e5d338f333a | |
parent | d24614c77a3eb5e889dbe4caaf63b065d1bb3c4a (diff) |
Try deleting WiresharkDialog when we close it.
QDialog::accept and ::reject hide the dialog but don't delete it. In the
case of WiresharkDialog and its subclasses we might leak memory or leave
files open. Call deleteLater when we close the dialog.
Change-Id: Ie0b848a7deeeee4667925b0d886e498f13a86bfc
Reviewed-on: https://code.wireshark.org/review/9781
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r-- | ui/qt/rtp_analysis_dialog.cpp | 8 | ||||
-rw-r--r-- | ui/qt/rtp_analysis_dialog.h | 3 | ||||
-rw-r--r-- | ui/qt/wireshark_dialog.cpp | 16 | ||||
-rw-r--r-- | ui/qt/wireshark_dialog.h | 3 |
4 files changed, 19 insertions, 11 deletions
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp index ab94ba3b15..f7d4b79c18 100644 --- a/ui/qt/rtp_analysis_dialog.cpp +++ b/ui/qt/rtp_analysis_dialog.cpp @@ -465,14 +465,6 @@ RtpAnalysisDialog::~RtpAnalysisDialog() delete rev_tempfile_; } -// XXX Should we do this in WiresharkDialog? -void RtpAnalysisDialog::reject() -{ - // We need to make sure our temporary files are closed. - deleteLater(); - WiresharkDialog::reject(); -} - void RtpAnalysisDialog::updateWidgets() { bool enable_tab = false; diff --git a/ui/qt/rtp_analysis_dialog.h b/ui/qt/rtp_analysis_dialog.h index 99f9bd2f64..eea724113a 100644 --- a/ui/qt/rtp_analysis_dialog.h +++ b/ui/qt/rtp_analysis_dialog.h @@ -54,9 +54,6 @@ public: signals: void goToPacket(int packet_num); -protected: - virtual void reject(); - protected slots: virtual void updateWidgets(); diff --git a/ui/qt/wireshark_dialog.cpp b/ui/qt/wireshark_dialog.cpp index 7ca270ed20..87403ade60 100644 --- a/ui/qt/wireshark_dialog.cpp +++ b/ui/qt/wireshark_dialog.cpp @@ -50,6 +50,22 @@ WiresharkDialog::WiresharkDialog(QWidget &, CaptureFile &capture_file) : setWindowTitleFromSubtitle(); } +void WiresharkDialog::accept() +{ + // We need to make sure our destructor is called. + deleteLater(); + QDialog::accept(); +} + +// XXX Should we do this in WiresharkDialog? +void WiresharkDialog::reject() +{ + // We need to make sure our destructor is called. + deleteLater(); + QDialog::reject(); +} + + void WiresharkDialog::setWindowSubtitle(const QString &subtitle) { subtitle_ = subtitle; diff --git a/ui/qt/wireshark_dialog.h b/ui/qt/wireshark_dialog.h index 3e7e1e4334..33ca4100d9 100644 --- a/ui/qt/wireshark_dialog.h +++ b/ui/qt/wireshark_dialog.h @@ -40,6 +40,9 @@ public slots: protected: virtual void keyPressEvent(QKeyEvent *event) { QDialog::keyPressEvent(event); } + virtual void accept(); + virtual void reject(); + void setWindowSubtitle(const QString &subtitle); const QString &windowSubtitle() { return subtitle_; } virtual void updateWidgets(); |