aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-11-15 20:25:33 +0000
committerGerald Combs <gerald@wireshark.org>2013-11-15 20:25:33 +0000
commitde4c6a2d07c0d28ee35e19c2f98b028dcca53f8c (patch)
treedbc9938824506885a0fb3a54aff3ab7f0fd4cc99
parent1868bd172bde87087d0d150a8c44570d70d55efd (diff)
Reset data_out_file when we close it. Add comments and fixup whitespace.
svn path=/trunk/; revision=53343
-rw-r--r--ui/qt/follow_stream_dialog.cpp25
-rw-r--r--ui/qt/follow_stream_dialog.h2
2 files changed, 18 insertions, 9 deletions
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 3dd826a6a2..0c1f159407 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -301,7 +301,13 @@ void FollowStreamDialog::resetStream()
filter_out_filter_.clear();
text_pos_to_packet_.clear();
- if (!data_out_filename_.isEmpty()) ws_unlink(data_out_filename_.toUtf8().constData());
+ if (!data_out_filename_.isEmpty()) {
+ ws_unlink(data_out_filename_.toUtf8().constData());
+ }
+ if (data_out_file) {
+ fclose(data_out_file);
+ data_out_file = NULL;
+ }
for (cur = follow_info_.payload; cur; cur = g_list_next(cur)) {
g_free(cur->data);
}
@@ -309,7 +315,6 @@ void FollowStreamDialog::resetStream()
follow_info_.payload = NULL;
}
-// XXX We end up calling this twice when we open the dialog.
frs_return_t
FollowStreamDialog::follow_read_stream()
{
@@ -873,9 +878,6 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
}
}
-
- /* Allocate our new filter. */
-
/* append the negation */
if(!previous_filter.isEmpty()) {
filter_out_filter_ = QString("%1 and !(%2)")
@@ -950,6 +952,16 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
return false;
}
+ /* Go back to the top of the file and read the first tcp_stream_chunk
+ * to ensure that the IP addresses and port numbers in the drop-down
+ * list are tied to the correct lines displayed by follow_read_stream()
+ * later on (which also reads from this file). Close the file when
+ * we're done.
+ *
+ * We read the data now, before we pop up a window, in case the
+ * read fails. We use the data later.
+ */
+
rewind(data_out_file);
nchars=fread(&sc, 1, sizeof(sc), data_out_file);
if (nchars != sizeof(sc)) {
@@ -1122,13 +1134,11 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
break;
}
-
ui->cbDirections->clear();
this->ui->cbDirections->addItem(both_directions_string);
this->ui->cbDirections->addItem(client_to_server_string);
this->ui->cbDirections->addItem(server_to_client_string);
-
follow_stream();
fillHintLabel(-1);
@@ -1137,7 +1147,6 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
return true;
}
-
#define FLT_BUF_SIZE 1024
/*
diff --git a/ui/qt/follow_stream_dialog.h b/ui/qt/follow_stream_dialog.h
index 45db0e22b7..d8212c6129 100644
--- a/ui/qt/follow_stream_dialog.h
+++ b/ui/qt/follow_stream_dialog.h
@@ -134,7 +134,7 @@ private:
int client_packet_count_;
int server_packet_count_;
guint32 last_packet_;
- bool last_from_server_;
+ gboolean last_from_server_;
int turns_;
QMap<int,guint32> text_pos_to_packet_;