aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-10-20 03:43:03 +0100
committerMichael Mann <mmann78@netscape.net>2017-10-20 12:13:02 +0000
commit0088d010edb1dc9704efa1ad11e7d0975b6878ba (patch)
tree35b917d5ee360b5a7d3a7910281257d3f18bc72b
parentc23e3761a550ca5e44cb3878fa47d7c00f469424 (diff)
Qt: fix crash after loading SRT dialog
TapParameterDialog::on_applyFilterButton_clicked first calls fillTree to populate the table and endRetapPackets to add the results to GUI. The table data must remain valid until closing the dialog since the user can still interact with the GUI. Change-Id: Ie3105be78d39c562af52f2b49081552063afcada Ping-Bug: 14141 Reviewed-on: https://code.wireshark.org/review/23994 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--ui/qt/service_response_time_dialog.cpp15
-rw-r--r--ui/qt/service_response_time_dialog.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/ui/qt/service_response_time_dialog.cpp b/ui/qt/service_response_time_dialog.cpp
index 1e142ef..b79ce7f 100644
--- a/ui/qt/service_response_time_dialog.cpp
+++ b/ui/qt/service_response_time_dialog.cpp
@@ -210,6 +210,14 @@ ServiceResponseTimeDialog::ServiceResponseTimeDialog(QWidget &parent, CaptureFil
this, SLOT(statsTreeWidgetItemChanged()));
}
+ServiceResponseTimeDialog::~ServiceResponseTimeDialog()
+{
+ if (srt_data_.srt_array) {
+ free_srt_table(srt_, srt_data_.srt_array, NULL, NULL);
+ g_array_free(srt_data_.srt_array, TRUE);
+ }
+}
+
TapParameterDialog *ServiceResponseTimeDialog::createSrtDialog(QWidget &parent, const QString cfg_str, const QString filter, CaptureFile &cf)
{
if (!cfg_str_to_srt_.contains(cfg_str)) {
@@ -269,6 +277,10 @@ void ServiceResponseTimeDialog::endRetapPackets()
void ServiceResponseTimeDialog::fillTree()
{
+ if (srt_data_.srt_array) {
+ free_srt_table(srt_, srt_data_.srt_array, NULL, NULL);
+ g_array_free(srt_data_.srt_array, TRUE);
+ }
srt_data_.srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*));
srt_data_.user_data = this;
@@ -301,9 +313,6 @@ void ServiceResponseTimeDialog::fillTree()
statsTreeWidget()->setSortingEnabled(true);
removeTapListeners();
-
- free_srt_table(srt_, srt_data_.srt_array, NULL, NULL);
- g_array_free(srt_data_.srt_array, TRUE);
}
QList<QVariant> ServiceResponseTimeDialog::treeItemData(QTreeWidgetItem *ti) const
diff --git a/ui/qt/service_response_time_dialog.h b/ui/qt/service_response_time_dialog.h
index f3273ac..ec953eb 100644
--- a/ui/qt/service_response_time_dialog.h
+++ b/ui/qt/service_response_time_dialog.h
@@ -36,6 +36,7 @@ class ServiceResponseTimeDialog : public TapParameterDialog
public:
ServiceResponseTimeDialog(QWidget &parent, CaptureFile &cf, struct register_srt *srt, const QString filter, int help_topic = 0);
+ ~ServiceResponseTimeDialog();
static TapParameterDialog *createSrtDialog(QWidget &parent, const QString cfg_str, const QString filter, CaptureFile &cf);
public slots: