Qt: Fix IO Graph capture file closing.

Make sure our IOGraphs remove their respective tap listeners before the
capture file closes, otherwise the graph data ends up getting cleared
via reset_tap_listeners.

Bug: 10871
Change-Id: I0ef2af2dc84be1921a930df8bb68f63626aa874a
Reviewed-on: https://code.wireshark.org/review/6925
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-02-02 16:22:31 -08:00
parent 9d7f5c7611
commit 00f7bc4b3d
2 changed files with 8 additions and 5 deletions

View File

@ -53,8 +53,6 @@
// UAT. We should add a "graph color" preference.
// - We retap and redraw more than we should.
// - Smoothing doesn't seem to match GTK+
// - We don't register a tap listener ("-z io,stat", bottom of gtk/io_stat.c)
// - Hovering over a graph when the file is closed clears the graph.
// To do:
// - Use scroll bars?
@ -338,6 +336,7 @@ void IOGraphDialog::addGraph(bool checked, QString name, QString dfilter, int co
ti->setData(sma_period_col_, Qt::UserRole, moving_average);
connect(this, SIGNAL(recalcGraphData(capture_file *)), iog, SLOT(recalcGraphData(capture_file *)));
connect(&cap_file_, SIGNAL(captureFileClosing()), iog, SLOT(captureFileClosing()));
connect(iog, SIGNAL(requestRetap()), this, SLOT(scheduleRetap()));
connect(iog, SIGNAL(requestRecalc()), this, SLOT(scheduleRecalc()));
connect(iog, SIGNAL(requestReplot()), this, SLOT(scheduleReplot()));
@ -949,7 +948,7 @@ void IOGraphDialog::updateStatistics()
cap_file_.retapPackets();
ui->ioPlot->setFocus();
} else {
if (need_recalc_) {
if (need_recalc_ && !file_closed_) {
need_recalc_ = false;
need_replot_ = true;
emit recalcGraphData(cap_file_.capFile());
@ -1084,7 +1083,6 @@ void IOGraphDialog::loadProfileGraphs()
}
}
// Slots
void IOGraphDialog::lineEditDestroyed()
@ -1919,10 +1917,14 @@ void IOGraph::recalcGraphData(capture_file *cap_file)
}
// qDebug() << "=rgd i" << i << ts << val;
}
// qDebug() << "=rgd" << num_items_ << hf_index_;
emit requestReplot();
}
void IOGraph::captureFileClosing()
{
remove_tap_listener(this);
}
void IOGraph::setInterval(int interval)
{
interval_ = interval;

View File

@ -90,6 +90,7 @@ public:
public slots:
void recalcGraphData(capture_file *cap_file);
void captureFileClosing();
signals:
void requestReplot();