aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/rtp_stream_dialog.cpp
diff options
context:
space:
mode:
authorJirka Novak <j.novak@netsystem.cz>2021-02-05 09:58:38 +0100
committerAndersBroman <a.broman58@gmail.com>2021-02-05 12:45:01 +0000
commit67c666b251501424266d5746f6281acfa98ce5f9 (patch)
treea956f34ca9b63a93cd57be5584a3f6743324464e /ui/qt/rtp_stream_dialog.cpp
parent1bb97c59736be68a042900c83b01ec3aeacd2a99 (diff)
RTP Stream Dialog fix: Duplicated streams could be shown
It may happen that a stream could be shown twice or more time in the list. Patch solves it.
Diffstat (limited to 'ui/qt/rtp_stream_dialog.cpp')
-rw-r--r--ui/qt/rtp_stream_dialog.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/ui/qt/rtp_stream_dialog.cpp b/ui/qt/rtp_stream_dialog.cpp
index bc63b4b290..88b4e2ee96 100644
--- a/ui/qt/rtp_stream_dialog.cpp
+++ b/ui/qt/rtp_stream_dialog.cpp
@@ -424,13 +424,19 @@ void RtpStreamDialog::tapMarkPacket(rtpstream_tapinfo_t *tapinfo, frame_data *fd
void RtpStreamDialog::updateStreams()
{
- GList *cur_stream = g_list_nth(tapinfo_.strinfo_list, static_cast<guint>(ui->streamTreeWidget->topLevelItemCount()));
+ // string_list is reverse ordered, so we must add
+ // just first "to_insert_count" of streams
+ GList *cur_stream = g_list_first(tapinfo_.strinfo_list);
+ guint tap_len = g_list_length(tapinfo_.strinfo_list);
+ guint tree_len = static_cast<guint>(ui->streamTreeWidget->topLevelItemCount());
+ guint to_insert_count = tap_len - tree_len;
// Add any missing items
- while (cur_stream && cur_stream->data) {
+ while (cur_stream && cur_stream->data && to_insert_count) {
rtpstream_info_t *stream_info = gxx_list_data(rtpstream_info_t*, cur_stream);
new RtpStreamTreeWidgetItem(ui->streamTreeWidget, stream_info);
cur_stream = gxx_list_next(cur_stream);
+ to_insert_count--;
}
// Recalculate values