jimevins / glabels

gLabels Label Designer
http://glabels.org
GNU General Public License v3.0
66 stars 25 forks source link

Prevent crash when using combo search on “Select Product” #32

Closed githubert closed 6 years ago

githubert commented 7 years ago

Re-submitting an earlier botched pull request.

Starting to type in the pre-defined labels combo boxes (e.g., File → New → Recent/Search all/Custom) would crash the program.

As per additional description:

GtkSelectionMode can also be GTK_SELECTION_BROWSE, which does not
guarantee that a selection is available. Checking the return value
of gtk_tree_selection_get_selected() seems to provides a clearer
picture.

I'm not really experienced with GTK, but this seems like a reasonably well working solution.

Testing done: After applying the patch, I can search in the list of pre-defined labels by starting to type. Clearing the search pop-up results in nothing to be selected, which causes the 'Next' button to be disabled, as expected.

jimevins commented 6 years ago

Manually applied to master and glabels-3_4.