Qt: fix a crash when closing a file while capture file properties window is open
authorPascal Quantin <pascal.quantin@gmail.com>
Sat, 20 Dec 2014 21:27:54 +0000 (22:27 +0100)
committerGerald Combs <gerald@wireshark.org>
Sun, 21 Dec 2014 04:13:40 +0000 (04:13 +0000)
refresh_button_ and copy_comment_button_ are not used neither initialized, get rid of them
Also clear text areas and disable buttons

Change-Id: I418d712313041dcf4f15aceee01497f01ae74918
Reviewed-on: https://code.wireshark.org/review/5927
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
ui/qt/capture_file_properties_dialog.cpp
ui/qt/capture_file_properties_dialog.h

index 47673ad548d1ad088c853f4e6d75a8eaf1025f79..96816e8f94600e813e9ab0aa138d1360fed0700c 100644 (file)
@@ -90,11 +90,23 @@ void CaptureFilePropertiesDialog::setCaptureFile(capture_file *cf)
 
 void CaptureFilePropertiesDialog::updateWidgets()
 {
+    QPushButton *refresh_bt = ui->buttonBox->button(QDialogButtonBox::Reset);
     QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save);
+    QPushButton *copy_bt = ui->buttonBox->button(QDialogButtonBox::Apply);
+
     if (!cap_file_) {
-        refresh_button_->setEnabled(false);
+        if (refresh_bt) {
+            refresh_bt->setEnabled(false);
+        }
+        ui->detailsTextEdit->clear();
+        ui->commentsTextEdit->clear();
         ui->commentsTextEdit->setReadOnly(true);
-        save_bt->setEnabled(false);
+        if (save_bt) {
+            save_bt->setEnabled(false);
+        }
+        if (copy_bt) {
+            copy_bt->setEnabled(false);
+        }
         return;
     }
 
index c4df9f1316463230610afe0baa16ca3db43e281e..27e6a4ff95d1e4513786030508ec23bd9b4b2112 100644 (file)
@@ -72,9 +72,6 @@ private:
     Ui::SummaryDialog *ui;
     capture_file *cap_file_;
 
-    QPushButton *refresh_button_;
-    QPushButton *copy_comment_button_;
-
     QString timeToString(time_t ti_time);
     QString summaryToHtml();