Wireshark-commits: [Wireshark-commits] master-2.6 d0da2d5: main window: don't keep a dangling freez

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Mon, 09 Apr 2018 04:53:11 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=d0da2d567078609f3610b13d6773cb7281ed9568
Submitter: Roland Knall (rknall@xxxxxxxxx)
Changed: branch: master-2.6
Repository: wireshark

Commits:

d0da2d5 by Martin Kaiser (wireshark@xxxxxxxxx):

    main window: don't keep a dangling freeze_focus_ pointer
    
    Without this fix, Wireshark crashes when the user presses Ctrl-D or
    selects Edit / Ignore Packet and the current focus is somewhere on the
    bytes view.
    
    To ignore a packet, we protect the actual ignore operation by calling
    main window's freeze and thaw methods. We save a pointer freeze_focus_,
    pointing to the widget that has the focus, and restore the focus during
    thaw.
    
    This causes a crash if the focused widget is part of ByteViewTab.
    Ignoring the packet causes a redissection, the ByteViewTab and its
    children are cleared. freeze_focus_ remains non-NULL but doesn't point
    to a valid QWdiget any more. Calling freeze_focus_->setFocus() crashes.
    
    Fix this by using a QPointer<QWdiget> for freeze_focus_. The pointer is
    then reset to NULL when the QWdiget that it points to goes out of scope.
    
    Change-Id: Icc1f71a9de971284c628b7815a7fc1a5cc0d5fe2
    Reviewed-on: https://code.wireshark.org/review/26693
    Reviewed-by: Martin Kaiser <wireshark@xxxxxxxxx>
    Petri-Dish: Martin Kaiser <wireshark@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    Reviewed-by: Roland Knall <rknall@xxxxxxxxx>
    (cherry picked from commit f0fed342165145461ed88358d2fc8985d15f3745)
    Reviewed-on: https://code.wireshark.org/review/26816
    Petri-Dish: Roland Knall <rknall@xxxxxxxxx>
    

Actions performed:

    from  088e084   Mark some fields as being in units of dBm.
    adds  d0da2d5   main window: don't keep a dangling freeze_focus_ pointer


Summary of changes:
 ui/qt/main_window.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)