Capture file retapping fixups.

Add CaptureFile::delayedRetapPackets, which starts retapping after the
current batch of UI event are processed. Call it in the constructors of
various dialogs so that they are shown before tapping starts.

This *might* fix a crash found when following large streams from the
Conversations dialog.

Change-Id: If1b87491621ab7efcc0519f95891d34dcd9d18c1
Reviewed-on: https://code.wireshark.org/review/9818
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-07-29 10:36:46 -07:00
parent 5b856134f6
commit a03a43bd32
9 changed files with 30 additions and 13 deletions

View File

@ -36,6 +36,7 @@ capture_file cfile;
#include "ui/capture.h"
#include <QFileInfo>
#include <QTimer>
// To do:
// - Add getters and (if needed) setters:
@ -96,6 +97,11 @@ void CaptureFile::retapPackets()
}
}
void CaptureFile::delayedRetapPackets()
{
QTimer::singleShot(0, this, SLOT(retapPackets()));
}
void CaptureFile::reload()
{
if (cap_file_ && cap_file_->state == FILE_READ_DONE) {

View File

@ -68,10 +68,6 @@ public:
*/
const QString fileName();
/** Retap the capture file
*/
void retapPackets();
/** Re;load the capture file
*/
void reload();
@ -107,11 +103,26 @@ signals:
void captureCaptureFailed(capture_session *cap_session);
public slots:
/** Retap the capture file. Convenience wrapper for cf_retap_packets.
* Application events are processed periodically via update_progress_dlg.
*/
void retapPackets();
/** Retap the capture file after the current batch of application events
* is processed. If you call this instead of retapPackets or
* cf_retap_packets in a dialog's constructor it will be displayed before
* tapping starts.
*/
void delayedRetapPackets();
/** Cancel any tapping that might be in progress.
*/
void stopLoading();
// XXX Not used.
/** Sets the capture file's "stop_flag" member.
*
* @param stop_flag If true, stops the current capture file operation.
*/
void setCaptureStopFlag(bool stop_flag = true);
private:

View File

@ -98,7 +98,7 @@ ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli
updateWidgets();
itemSelectionChanged();
cap_file_.retapPackets();
cap_file_.delayedRetapPackets();
}
ConversationDialog::~ConversationDialog()
@ -228,7 +228,7 @@ void ConversationDialog::followStream()
}
emit filterAction(filter, FilterAction::ActionApply, FilterAction::ActionTypePlain);
openFollowStreamDialog(ftype);
emit openFollowStreamDialog(ftype);
}
void ConversationDialog::graphTcp()

View File

@ -85,7 +85,7 @@ EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_i
#endif
itemSelectionChanged();
cap_file_.retapPackets();
cap_file_.delayedRetapPackets();
}
EndpointDialog::~EndpointDialog()

View File

@ -2528,8 +2528,8 @@ void MainWindow::openFollowStreamDialog(follow_type_t type) {
connect(fsd, SIGNAL(updateFilter(QString&, bool)), this, SLOT(filterPackets(QString&, bool)));
connect(fsd, SIGNAL(goToPacket(int)), packet_list_, SLOT(goToPacket(int)));
fsd->follow(getFilter());
fsd->show();
fsd->follow(getFilter());
}
void MainWindow::on_actionAnalyzeFollowTCPStream_triggered()

View File

@ -262,7 +262,7 @@ void ResponseTimeDelayDialog::fillTree()
statsTreeWidget()->setSortingEnabled(false);
cf_retap_packets(cap_file_.capFile());
cap_file_.retapPackets();
tapDraw(&rtd_data);

View File

@ -317,7 +317,7 @@ void ServiceResponseTimeDialog::fillTree()
statsTreeWidget()->setSortingEnabled(false);
cf_retap_packets(cap_file_.capFile());
cap_file_.retapPackets();
// We only have one table. Move its tree items up one level.
if (statsTreeWidget()->invisibleRootItem()->childCount() == 1) {

View File

@ -261,7 +261,7 @@ void SimpleStatisticsDialog::fillTree()
reject();
}
cf_retap_packets(cap_file_.capFile());
cap_file_.retapPackets();
tapDraw(&stat_data);

View File

@ -192,7 +192,7 @@ VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flow
updateWidgets();
tapinfo_.session = cap_file_.capFile()->epan;
cap_file_.retapPackets();
cap_file_.delayedRetapPackets();
}
VoipCallsDialog::~VoipCallsDialog()