package: cdebconf-gtk-udeb
severity: normal
tags: patch
Suppose a SELECT question has options
mickey
goofy
donald
goofy
and goofy (present twice in the options list) is the default option:
you'll get a crash under directfb and a warning under x11 as soon as the
question gets displayed.
The crash is avoidable by adding with an extra check on the flag
variable that indicates whether the default option was already found or not.
Usually you don't have twice the same option in a SELECT question, but
anyway i think this bug has to be fixed ASAP.
cheers
Attilio
Index: gtk.c
===================================================================
--- gtk.c (revisione 43298)
+++ gtk.c (copia locale)
@@ -964,7 +964,7 @@
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, SELECT_COL_NAME, choices_translated[i], -1);
- if (defval && strcmp(choices[tindex[i]], defval) == 0)
+ if (!flag_default_set && defval && strcmp(choices[tindex[i]], defval) == 0)
{
expose_data -> path = gtk_tree_path_to_string (gtk_tree_model_get_path (model, &iter));
expose_data -> callback_function = g_signal_connect_after (G_OBJECT(view), "expose_event", G_CALLBACK (treeview_exposed_callback), (gpointer) expose_data);
@@ -1073,7 +1073,7 @@
gtk_tree_store_append (store, &child, &iter);
gtk_tree_store_set (store, &child, SELECT_COL_NAME, choices_translated[i], -1);
- if (defval && strcmp(choices[tindex[i]], defval) == 0)
+ if (!flag_default_set && defval && strcmp(choices[tindex[i]], defval) == 0)
{
gtk_tree_view_expand_row (GTK_TREE_VIEW (view), gtk_tree_model_get_path (model, &iter), TRUE);
expose_data -> path = gtk_tree_path_to_string (gtk_tree_model_get_path (model, &child));
@@ -1089,7 +1089,7 @@
gtk_tree_store_append (store, &child, &iter);
gtk_tree_store_set (store, &child, SELECT_COL_NAME, choices_translated[i], -1);
gtk_tree_view_expand_row (GTK_TREE_VIEW(view), gtk_tree_model_get_path(model, &iter), TRUE);
- if (defval && strcmp(choices[tindex[i]], defval) == 0)
+ if (!flag_default_set && defval && strcmp(choices[tindex[i]], defval) == 0)
{
expose_data -> path = gtk_tree_path_to_string (gtk_tree_model_get_path (model, &child));
expose_data -> callback_function = g_signal_connect_after (G_OBJECT(view), "expose_event", G_CALLBACK (treeview_exposed_callback), (gpointer) expose_data);
@@ -1100,7 +1100,7 @@
{ /* father, disk */
gtk_tree_store_append (store, &iter,NULL);
gtk_tree_store_set (store, &iter, SELECT_COL_NAME, choices_translated[i], -1);
- if (defval && strcmp(choices[tindex[i]], defval) == 0)
+ if (!flag_default_set && defval && strcmp(choices[tindex[i]], defval) == 0)
{
expose_data -> path = gtk_tree_path_to_string (gtk_tree_model_get_path (model, &iter));
expose_data -> callback_function = g_signal_connect_after (G_OBJECT(view), "expose_event", G_CALLBACK (treeview_exposed_callback), (gpointer) expose_data);