Quick search with Czech characters -> Crash

Crash happen when checking for "event.string" in "treeview_keypress"
function in "gramps/gui/widgets/interactivesearchbox.py"
Note that

https://lazka.github.io/pgi-docs/Gdk-3.0/classes/EventKey.html#Gdk.EventKey
says it is deprecated and should never be used.

Gdk.keyval_to_unicode return the corresponding unicode character, or 0
if there is no corresponding character.

Fixes #9130.

(cherry picked from commit bc17245331)
This commit is contained in:
Josip 2017-05-28 23:32:20 +02:00
parent 7a61a0e96f
commit 26c50fdbdd
2 changed files with 3 additions and 3 deletions

View File

@ -891,7 +891,7 @@ class ListView(NavigationView):
self.edit(obj)
return True
# Custom interactive search
if event.string:
if Gdk.keyval_to_unicode(event.keyval):
return self.searchbox.treeview_keypress(obj, event)
return False
@ -919,7 +919,7 @@ class ListView(NavigationView):
else:
self.edit(obj)
return True
elif event.string:
elif Gdk.keyval_to_unicode(event.keyval):
# Custom interactive search
return self.searchbox.treeview_keypress(obj, event)
return False

View File

@ -70,7 +70,7 @@ class InteractiveSearchBox():
function handling keypresses from the treeview
for the typeahead find capabilities
"""
if not event.string:
if not Gdk.keyval_to_unicode(event.keyval):
return False
if self._key_cancels_search(event.keyval):
return False