Ensure a single Follow Stream is running only
When changing one of the selection parameters in the Follow Stream dialog while a filtering task is already running, the result is inaccurate. While a filtering task is already running in the Follow Stream dialog, any filter change which triggers a new filtering gives a wrong result. Both the displayed data and the Save As functions are impacted. Closes #15637
This commit is contained in:
parent
a36e995dd3
commit
5863a7cbeb
|
@ -47,6 +47,7 @@
|
|||
#include <QElapsedTimer>
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QMutex>
|
||||
#include <QPrintDialog>
|
||||
#include <QPrinter>
|
||||
#include <QScrollBar>
|
||||
|
@ -63,6 +64,9 @@
|
|||
// Matches SplashOverlay.
|
||||
static int info_update_freq_ = 100;
|
||||
|
||||
// Handle the loop breaking notification properly
|
||||
static QMutex loop_break_mutex;
|
||||
|
||||
FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_type_t type) :
|
||||
WiresharkDialog(parent, cf),
|
||||
ui(new Ui::FollowStreamDialog),
|
||||
|
@ -80,6 +84,7 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_
|
|||
turns_(0),
|
||||
use_regex_find_(false),
|
||||
terminating_(false),
|
||||
isReadRunning_(false),
|
||||
previous_sub_stream_num_(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -544,6 +549,11 @@ frs_return_t
|
|||
FollowStreamDialog::readStream()
|
||||
{
|
||||
|
||||
// interrupt any reading already running
|
||||
loop_break_mutex.lock();
|
||||
isReadRunning_ = FALSE;
|
||||
loop_break_mutex.unlock();
|
||||
|
||||
ui->teStreamContent->clear();
|
||||
text_pos_to_packet_.clear();
|
||||
|
||||
|
@ -1215,8 +1225,12 @@ FollowStreamDialog::readFollowStream()
|
|||
|
||||
elapsed_timer.start();
|
||||
|
||||
loop_break_mutex.lock();
|
||||
isReadRunning_ = TRUE;
|
||||
loop_break_mutex.unlock();
|
||||
|
||||
for (cur = g_list_last(follow_info_.payload); cur; cur = g_list_previous(cur)) {
|
||||
if (dialogClosed()) break;
|
||||
if (dialogClosed() || !isReadRunning_) break;
|
||||
|
||||
follow_record = (follow_record_t *)cur->data;
|
||||
skip = FALSE;
|
||||
|
@ -1255,5 +1269,9 @@ FollowStreamDialog::readFollowStream()
|
|||
}
|
||||
}
|
||||
|
||||
loop_break_mutex.lock();
|
||||
isReadRunning_ = FALSE;
|
||||
loop_break_mutex.unlock();
|
||||
|
||||
return FRS_OK;
|
||||
}
|
||||
|
|
|
@ -122,6 +122,7 @@ private:
|
|||
bool use_regex_find_;
|
||||
|
||||
bool terminating_;
|
||||
bool isReadRunning_;
|
||||
|
||||
int previous_sub_stream_num_;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue