Wireshark-commits: [Wireshark-commits] master bfaef4c: Give a PacketDialog a Buffer and read direct

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Mon, 15 Apr 2019 04:10:41 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=bfaef4cf48adc371d855e08fecbdd65a8344fd16
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

bfaef4c by Guy Harris (guy@xxxxxxxxxxxx):

    Give a PacketDialog a Buffer and read directly into it and into its wtap_rec.
    
    We may or may not be working on the currently-selected packet, so
    there's no reason to use read into the capture_file's wtap_rec and
    Buffer for the currently-selected packet.  We already have a wtap_rec of
    our own, and we currently have a pointer to a raw packet data array that
    we can replace with a Buffer of our own; just read into them.
    
    Use wtap_rec_init() on the wtap_rec, rather than using its implicit
    constructor - there's no guarantee that the initial values of the
    structure members, as defined by C (and C++), are what we want.
    
    Use wtap_rec_cleanup() in the destructor; it might do more than the
    implied destructor (which does nothing).  wtap_rec and Buffer are C
    structures, so they don't get C++ constructors and destructors - we have
    to use the C ones, which are explicit functions.  I think there are
    memory leaks that this fixes (packet comments and Buffer for the options
    data, leaked when a PacketDialog window is closed).
    
    Change-Id: Ica1d937fd00e4d2f5e4e2275bcd8edddb7a7921b
    Reviewed-on: https://code.wireshark.org/review/32832
    Petri-Dish: Guy Harris <guy@xxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  9d7d4c0   wsutil: Read stderr and stdout data asynchronously
     add  bfaef4c   Give a PacketDialog a Buffer and read directly into it and into its wtap_rec.


Summary of changes:
 ui/qt/packet_dialog.cpp | 23 ++++++++++-------------
 ui/qt/packet_dialog.h   |  5 +++--
 2 files changed, 13 insertions(+), 15 deletions(-)