Wireshark-commits: [Wireshark-commits] master 74b20dc: gtk: fix crash on Broadway GDK backend

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 11 Jan 2015 17:45:52 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=74b20dca8c255672259d0c43004665d1e9f192dd
Submitter: Balint Reczey (balint@xxxxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

74b20dc by Peter Wu (peter@xxxxxxxxxxxxx):

    gtk: fix crash on Broadway GDK backend
    
    The Broadway GDK backend does never sets event->string. This results in
    a crash when filter_string_te_key_pressed_cb tries to read its contents.
    
    Since the documentation marks reading the string as deprecated, try to
    handle the character conversion here. It is based on
    _gdk_x11_event_translate_keyboard_string (from gtk+), but without trying
    to interpret Escape as '\033', and without trying to convert control
    characters (example: Ctrl + 1). A buffer of 6 bytes is used to hold a
    UTF-8 code point (there is no zero terminator, so 7 bytes as found in
    the original implementation is unnecessary).
    
    As g_locale_from_utf8 returns dynamically allocated memory, change the
    control flow to have a single exit point where pointers are freed as
    needed.
    
    Reproduce with gtk3:
    $ broadwayd :5
    $ GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 wireshark-gtk
    (now open http://localhost:8085/ and start typing in the display filter)
    
    Keys tested: e € (AltGr + 5) ü (AltGr + ", u)
    In the X11 backend, these still get displayed correctly. In the broadway
    backend however, the accents are missing due to a bug in the broadway
    implementation.
    
    Change-Id: Ic1f0ee2b87cd573023ee8e966f06489b3b744dcf
    Reviewed-on: https://code.wireshark.org/review/5832
    Reviewed-by: Balint Reczey <balint@xxxxxxxxxxxxxxx>
    

Actions performed:

    from  ae2888a   CMake: Try to fix Cygwin a2x discovery.
    adds  74b20dc   gtk: fix crash on Broadway GDK backend


Summary of changes:
 ui/gtk/filter_autocomplete.c |   60 ++++++++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 26 deletions(-)