voip_calls_dialog: avoiding of 'remove_tap_listener(): no listener ...' warning

When voip_calls_dialog is opened and then closed, mentioned warning is shown
because voip_calls_remove_all_tap_listeners is called twice in two different
methods. Removing of the call from one of method is not possible therefore
I introduced variable which tracks whether voip_calls_remove_all_tap_listeners
was already called or not.

Change-Id: Ic3c206cb7baf6612958d383880af296af019ffd8
Reviewed-on: https://code.wireshark.org/review/35660
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jim Young <jim.young.ws@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Jirka Novak 2020-01-05 23:33:04 +01:00 committed by Alexis La Goutte
parent 376d877012
commit 17cd230a03
2 changed files with 15 additions and 4 deletions

View File

@ -44,7 +44,8 @@ enum { voip_calls_type_ = 1000 };
VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flows) :
WiresharkDialog(parent, cf),
ui(new Ui::VoipCallsDialog),
parent_(parent)
parent_(parent),
voip_calls_tap_listeners_removed_(false)
{
ui->setupUi(this);
loadGeometry(parent.width() * 4 / 5, parent.height() * 2 / 3);
@ -104,14 +105,20 @@ VoipCallsDialog::~VoipCallsDialog()
delete ui;
voip_calls_reset_all_taps(&tapinfo_);
voip_calls_remove_all_tap_listeners(&tapinfo_);
if (!voip_calls_tap_listeners_removed_) {
voip_calls_remove_all_tap_listeners(&tapinfo_);
voip_calls_tap_listeners_removed_ = true;
}
sequence_info_->unref();
g_queue_free(tapinfo_.callsinfos);
}
void VoipCallsDialog::removeTapListeners()
{
voip_calls_remove_all_tap_listeners(&tapinfo_);
if (!voip_calls_tap_listeners_removed_) {
voip_calls_remove_all_tap_listeners(&tapinfo_);
voip_calls_tap_listeners_removed_ = true;
}
WiresharkDialog::removeTapListeners();
}
@ -121,7 +128,10 @@ void VoipCallsDialog::captureFileClosing()
// the cache is active, the ToD cannot be modified.
ui->todCheckBox->setEnabled(false);
cache_model_->setSourceModel(NULL);
voip_calls_remove_all_tap_listeners(&tapinfo_);
if (!voip_calls_tap_listeners_removed_) {
voip_calls_remove_all_tap_listeners(&tapinfo_);
voip_calls_tap_listeners_removed_ = true;
}
tapinfo_.session = NULL;
WiresharkDialog::captureFileClosing();
}

View File

@ -65,6 +65,7 @@ private:
QPushButton *sequence_button_;
QPushButton *player_button_;
QPushButton *copy_button_;
bool voip_calls_tap_listeners_removed_;
// Tap callbacks
// static void tapReset(void *tapinfo_ptr);