Wireshark-commits: [Wireshark-commits] master f9522d8: Qt: fix crash on dragging in packet dialog

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Thu, 26 Apr 2018 16:41:46 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=f9522d8a23a375ddc8bd39cf556002cdec346ab1
Submitter: Peter Wu (peter@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

f9522d8 by Peter Wu (peter@xxxxxxxxxxxxx):

    Qt: fix crash on dragging in packet dialog
    
    "packet_dialog.cpp" does not use setCaptureFile, resulting in a NULL
    dereference while trying to obtain the dissection context. Apply a fix
    similar to v2.5.1rc0-121-g9198448f9d (pass a fixed dissection context to
    ProtoTree). Additionally, fix a memleak and correct documentation.
    
    Why not add "proto_tree_->setCaptureFile(cap_file_.capFile())" in
    PacketDialog? Well, it also uses "proto_tree_->setRootNode(edt_.tree)"
    which means that "cf_->edt" would be different from "edt_". If that is
    the case, then "proto_construct_match_selected_string" will not return a
    filter for FT_NONE fields (see the call chain in proto.c).
    
    Bug: 14620
    Change-Id: I6eeaf32b650a2095e15f64bbe64b54cdd545c7a9
    Fixes: v2.5.0rc0-1608-g4d6454e180 ("Qt: Drag n Drop Filter expression from Packet Tree")
    Reviewed-on: https://code.wireshark.org/review/27160
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Reviewed-by: Roland Knall <rknall@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    

Actions performed:

    from  cfc1583   Fix crash (double-free) on refreshing interfaces list
    adds  f9522d8   Qt: fix crash on dragging in packet dialog


Summary of changes:
 epan/proto.c            |  4 +---
 ui/qt/packet_dialog.cpp |  4 +++-
 ui/qt/proto_tree.cpp    | 16 ++++++++++++----
 ui/qt/proto_tree.h      |  3 ++-
 4 files changed, 18 insertions(+), 9 deletions(-)