Fine tune debugging.
1) If get_modifier() fails, set the label to "Unknown pos/id". Thus, label will always be non-null and debugging should be easier. The minor downside is that the label string is leaked when we update the modifier group. 2) Restore the assert in update_modifier_vbox() and the now unnecessary test of group[x].label.
This commit is contained in:
@@ -4614,7 +4614,8 @@ void update_modifier_linkable_list(GString *msg)
|
||||
group[i].settings = get_modifier_settings(modifier->values);
|
||||
group[i].settings_amt = 2;
|
||||
} else {
|
||||
group[i].label = "Unknown";
|
||||
// The string is leaked when the modifier list is updated.
|
||||
group[i].label = g_strdup_printf("Unknown pos %d id %d", position, id);
|
||||
group[i].settings = NULL;
|
||||
}
|
||||
|
||||
|
||||
9
gui.c
9
gui.c
@@ -763,6 +763,8 @@ static void update_modifier_vbox(GtkWidget *vbox, GObject *combo_box, gint id, g
|
||||
settings->type = group[x].type;
|
||||
settings->position = position;
|
||||
|
||||
g_assert(group[x].label);
|
||||
|
||||
if (position == EXP_POSITION) {
|
||||
child = g_object_steal_data(G_OBJECT(combo_box), "active_child");
|
||||
child = create_grid(group[x].settings, group[x].settings_amt,
|
||||
@@ -778,12 +780,7 @@ static void update_modifier_vbox(GtkWidget *vbox, GObject *combo_box, gint id, g
|
||||
g_object_set_data(G_OBJECT(combo_box), name, settings);
|
||||
g_free(name);
|
||||
|
||||
if (group[x].label) {
|
||||
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), group[x].label);
|
||||
} else {
|
||||
// If a device is not fully supported, mark the effect as unknown.
|
||||
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), "unknown");
|
||||
}
|
||||
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), group[x].label);
|
||||
widget_tree_add(combo_box, id, position, group[x].type, x);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user