[glabels/glabels-3_4] Prevent crash when using combo search on “Select Product”
- From: Jim Evins <jimevins src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glabels/glabels-3_4] Prevent crash when using combo search on “Select Product”
- Date: Sat, 14 Apr 2018 21:28:14 +0000 (UTC)
commit 056f8fc9c0dffc86b04bc5dcc133265a36324be5
Author: Clemens Fries <githubert xenoworld de>
Date: Mon Sep 18 21:02:09 2017 +0200
Prevent crash when using combo search on “Select Product”
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.
src/media-select.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/media-select.c b/src/media-select.c
index 11ecda0..88c80e7 100644
--- a/src/media-select.c
+++ b/src/media-select.c
@@ -786,14 +786,15 @@ gl_media_select_get_name (glMediaSelect *this)
g_assert_not_reached ();
}
- if (gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
+ gboolean has_selection = gtk_tree_selection_get_selected (selection, &model, &iter);
+
+ if (has_selection == TRUE)
{
- name = NULL;
+ gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
}
else
{
- gtk_tree_selection_get_selected (selection, &model, &iter);
- gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
+ name = NULL;
}
gl_debug (DEBUG_MEDIA_SELECT, "END");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]