This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
Setting an empty ListStore as TreeView's model causes crash when headers are visible #701
Comments
I think the problem lies below: directly in C libraries. Might be worth opening them an issue as well. |
This functionality seems so basic and common that I was assuming it's not GTK problem, but you're right, I gonna check it tomorrow. |
Thanks! I really hope the problem is coming from gtk-rs but I'm afraid it's not... Waiting to hear back from you! |
@GuillaumeGomez You're right, this is GTK problem. C version: #include <gtk/gtk.h>
enum { COL_NAME = 0, COL_AGE, NUM_COLS };
static GtkTreeModel *create_and_fill_model(void) {
GtkListStore *store;
store = gtk_list_store_new(NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
// Uncommenting these fixes the issue:
// GtkTreeIter iter;
// gtk_list_store_append(store, &iter);
// gtk_list_store_set(store, &iter, COL_NAME, "Heinz", COL_AGE, 51, -1);
return GTK_TREE_MODEL(store);
}
static GtkWidget *create_view_and_model(void) {
GtkCellRenderer *renderer;
GtkTreeModel *model;
GtkWidget *view;
view = gtk_tree_view_new();
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(
GTK_TREE_VIEW(view), -1, "Name", renderer, "text", COL_NAME, NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(
GTK_TREE_VIEW(view), -1, "Age", renderer, "text", COL_AGE, NULL);
model = create_and_fill_model();
gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
g_object_unref(model);
return view;
}
int main(int argc, char **argv) {
GtkWidget *window;
GtkWidget *view;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
view = create_view_and_model();
gtk_container_add(GTK_CONTAINER(window), view);
gtk_widget_show_all(window);
gtk_main();
return 0;
} |
ghost
closed this as completed
Sep 13, 2018
Can you link here the gtk issue when it's open please? |
Sure. |
Thanks! |
alex179ohm
pushed a commit
to alex179ohm/gtk
that referenced
this issue
Oct 21, 2019
Fix unstable super_calback's list for g_vfs_register_uri_scheme
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
PS: In my real code, calling
store.clear()
after initialization helps as well, still no idea why it doesn't work in this toy example.The text was updated successfully, but these errors were encountered: