[Freeciv-Dev] (PR#11067) gtk error in gui-gtk-2.0
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11067 >
> [jdorje - Thu Nov 18 08:49:45 2004]:
>
> (civclient:5699): Gtk-CRITICAL **: file gtkliststore.c: line 1013
> (gtk_list_store_remove): assertion `VALID_ITER (iter, list_store)' failed
>
> (civclient:5699): Gtk-CRITICAL **: file gtkliststore.c: line 590
> (gtk_list_store_iter_next): assertion `GTK_LIST_STORE
> (tree_model)->stamp == iter->stamp' failed
>
> (civclient:5699): Gtk-CRITICAL **: file gtkliststore.c: line 1013
> (gtk_list_store_remove): assertion `VALID_ITER (iter, list_store)' failed
>
> (civclient:5699): Gtk-CRITICAL **: file gtkliststore.c: line 590
> (gtk_list_store_iter_next): assertion `GTK_LIST_STORE
> (tree_model)->stamp == iter->stamp' failed
>
> No other information available.
I don't think it is the cause, but here is a code revamp for the player
report update code.
Index: client/gui-gtk-2.0/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.c,v
retrieving revision 1.14.2.4
diff -u -r1.14.2.4 gui_stuff.c
--- client/gui-gtk-2.0/gui_stuff.c 22 Nov 2004 04:33:01 -0000 1.14.2.4
+++ client/gui-gtk-2.0/gui_stuff.c 23 Nov 2004 21:57:55 -0000
@@ -179,14 +179,6 @@
/****************************************************************
...
*****************************************************************/
-void tstore_remove(ITree *it)
-{
- gtk_tree_store_remove(GTK_TREE_STORE(it->model), &it->it);
-}
-
-/****************************************************************
-...
-*****************************************************************/
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
{
return gtk_tree_selection_iter_is_selected(selection, &it->it);
Index: client/gui-gtk-2.0/gui_stuff.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.h,v
retrieving revision 1.9.2.2
diff -u -r1.9.2.2 gui_stuff.h
--- client/gui-gtk-2.0/gui_stuff.h 7 Nov 2004 14:23:26 -0000 1.9.2.2
+++ client/gui-gtk-2.0/gui_stuff.h 23 Nov 2004 21:57:55 -0000
@@ -41,7 +41,6 @@
void itree_set(ITree *it, ...);
void tstore_append(GtkTreeStore *store, ITree *it, ITree *parent);
-void tstore_remove(ITree *it);
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it);
void itree_select(GtkTreeSelection *selection, ITree *it);
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.39.2.5
diff -u -r1.39.2.5 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 14 Nov 2004 23:50:02 -0000 1.39.2.5
+++ client/gui-gtk-2.0/plrdlg.c 23 Nov 2004 21:57:55 -0000
@@ -57,6 +57,7 @@
static GtkWidget *players_vision_command;
static GtkWidget *players_sship_command;
static GtkListStore *store;
+static GtkTreeModel *model;
static gint ncolumns;
@@ -220,6 +221,7 @@
ncolumns = i;
store = gtk_list_store_newv(ncolumns, model_types);
+ model = GTK_TREE_MODEL(store);
}
/**************************************************************************
@@ -555,56 +557,52 @@
void update_players_dialog(void)
{
if (players_dialog_shell && !is_plrdlg_frozen()) {
- gboolean exists[MAX_NUM_PLAYERS];
+ gboolean exists[game.nplayers];
gint i;
- ITree it, it_next;
+ GtkTreeIter it, it_next;
- for (i = 0; i < MAX_NUM_PLAYERS; i++) {
+ for (i = 0; i < game.nplayers; i++) {
exists[i] = FALSE;
}
- itree_begin(GTK_TREE_MODEL(store), &it);
- while (!itree_end(&it)) {
+ if (gtk_tree_model_get_iter_first(model, &it)) {
gint plrno;
+ bool more;
- it_next = it;
- itree_next(&it_next);
-
- itree_get(&it, ncolumns - 1, &plrno, -1);
+ do {
+ it_next = it;
+ more = gtk_tree_model_iter_next(model, &it_next);
- /*
- * The nation already had a row in the player report. In that
- * case we just update the row.
- */
- if (plrno >= 0 && plrno < game.nplayers) {
- exists[plrno] = TRUE;
+ gtk_tree_model_get(model, &it, ncolumns - 1, &plrno, -1);
- build_row(&it.it, plrno);
- } else {
- gtk_list_store_remove(store, &it.it);
- }
+ /*
+ * The nation already had a row in the player report. In that
+ * case we just update the row.
+ */
+ if (is_valid_player_id(plrno)) {
+ exists[plrno] = TRUE;
- it = it_next;
+ build_row(&it, plrno);
+ } else {
+ gtk_list_store_remove(store, &it);
+ }
+ } while (more);
}
- for (i = 0; i < game.nplayers; i++) {
- GtkTreeIter iter;
-
+ players_iterate(pplayer) {
/* skip barbarians */
- if (is_barbarian(&game.players[i])) {
- continue;
- }
-
- if (!exists[i]) {
- /*
- * A nation is not in the player report yet. This happens when
- * the report is just opened and after a split.
- */
- gtk_list_store_append(store, &iter);
+ if (!is_barbarian(pplayer)) {
+ if (!exists[pplayer->player_no]) {
+ /*
+ * A nation is not in the player report yet. This happens when
+ * the report is just opened and after a split.
+ */
+ gtk_list_store_append(store, &it);
- build_row(&iter, i);
+ build_row(&it, pplayer->player_no);
+ }
}
- }
+ } players_iterate_end;
update_players_menu();
update_views();
|
|