Wireshark-commits: [Wireshark-commits] master f0fed34: main window: don't keep a dangling freeze_fo

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

Commits:

f0fed34 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>
    

Actions performed:

    from  55f6f65   CMake: More Qt4 removal.
    adds  f0fed34   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(-)