diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-02-29 16:34:32 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-04-06 23:37:34 +0000 |
commit | f611edf4e6061003d4eca88443c54b68d500cecd (patch) | |
tree | 4652e6ef9f9bbc59bdb9a7cfba0dbb5d22d8c53b /ui/gtk/follow_stream.c | |
parent | 2b2a9896811b237346b4f5c35e17a2dfd5f3ea97 (diff) |
Qt: Follow stream performance improvements.
Make FollowStreamText a subclass of QPlainTextEdit instead of QTextEdit.
For large amounts of text, the former should be less unbearably slow
than the latter. Increase the maximum stream size to 500MB. This isn't
perfect but it's much more usable than 2MB and much easier than the next
step, which is to write our own text display widget.
Process UI events while we fill in the stream data. This gives us
behavior similar to the GTK+ UI and is similar to what we do in other
dialogs.
Switch from g_memdup+g_free to a QByteArray in the Qt UI and GByteArray
in the GTK+ UI.
Don't call readStream twice.
Make sure we free all of our stream data in the Qt UI. This fixes a
serious memory leak.
Ping-Bug: 11777
Change-Id: Ibad9bde86692ae07a80660566d1e661ab8b64601
Reviewed-on: https://code.wireshark.org/review/14271
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/gtk/follow_stream.c')
-rw-r--r-- | ui/gtk/follow_stream.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ui/gtk/follow_stream.c b/ui/gtk/follow_stream.c index 1413ba54b0..183453fb1d 100644 --- a/ui/gtk/follow_stream.c +++ b/ui/gtk/follow_stream.c @@ -115,7 +115,7 @@ follow_common_read_stream(follow_info_t *follow_info, GList* cur; frs_return_t frs_return; follow_record_t *follow_record; - char *buffer; + GByteArray *buffer = g_byte_array_new(); for (cur = follow_info->payload; cur; cur = g_list_next(cur)) { @@ -134,22 +134,25 @@ follow_common_read_stream(follow_info_t *follow_info, } if (!skip) { - buffer = (char *)g_memdup(follow_record->data->data, + g_byte_array_set_size(buffer, 0); + g_byte_array_append(buffer, follow_record->data->data, follow_record->data->len); frs_return = follow_show(follow_info, follow_print, - buffer, + buffer->data, follow_record->data->len, follow_record->is_server, arg, global_pos, &server_packet_count, &client_packet_count); - g_free(buffer); - if(frs_return == FRS_PRINT_ERROR) + if(frs_return == FRS_PRINT_ERROR) { + g_byte_array_free(buffer, TRUE); return frs_return; + } } } + g_byte_array_free(buffer, TRUE); return FRS_OK; } |