diff -r f16a1cde664e -r 822fcb83bdf1 ui/gtk/list.c --- a/ui/gtk/list.c Tue Oct 29 11:29:18 2024 +0100 +++ b/ui/gtk/list.c Tue Oct 29 11:52:01 2024 +0100 @@ -187,6 +187,7 @@ UiList *list = var ? var->value : NULL; GtkListStore *listmodel = create_list_store(list, model); gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(listmodel)); + g_object_unref(listmodel); UiListView *listview = malloc(sizeof(UiListView)); listview->obj = obj; @@ -340,6 +341,7 @@ UiList *list = var ? var->value : NULL; GtkListStore *listmodel = create_list_store(list, model); gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(listmodel)); + g_object_unref(listmodel); //g_signal_connect(view, "drag-begin", G_CALLBACK(drag_begin), NULL); //g_signal_connect(view, "drag-end", G_CALLBACK(drag_end), NULL); @@ -498,7 +500,6 @@ GtkListStore *store = create_list_store(list, view->model); gtk_tree_view_set_model(GTK_TREE_VIEW(view->widget), GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); - // TODO: free old model } UiListSelection ui_listview_getselection(UiList *list) { @@ -518,16 +519,13 @@ } void ui_listview_destroy(GtkWidget *w, UiListView *v) { - gtk_tree_view_set_model(GTK_TREE_VIEW(w), NULL); + //gtk_tree_view_set_model(GTK_TREE_VIEW(w), NULL); ui_destroy_boundvar(v->obj->ctx, v->var); - // TODO: destroy model? free(v); } void ui_combobox_destroy(GtkWidget *w, UiListView *v) { - gtk_combo_box_set_model(GTK_COMBO_BOX(w), NULL); ui_destroy_boundvar(v->obj->ctx, v->var); - // TODO: destroy model? free(v); } @@ -636,6 +634,7 @@ if(listmodel) { gtk_combo_box_set_model(GTK_COMBO_BOX(combobox), GTK_TREE_MODEL(listmodel)); + g_object_unref(listmodel); } uicbox->var = var; @@ -698,6 +697,7 @@ UiListView *view = list->obj; GtkListStore *store = create_list_store(view->var->value, view->model); gtk_combo_box_set_model(GTK_COMBO_BOX(view->widget), GTK_TREE_MODEL(store)); + g_object_unref(store); } UiListSelection ui_combobox_getselection(UiList *list) {