Re: Programmer's criticism of GTK2
- From: Jonathan Blandford <jrb redhat com>
- To: Maxim Koshelev <max krascoal ru>
- Cc: gtk-app-devel-list gtk org
- Subject: Re: Programmer's criticism of GTK2
- Date: 18 Mar 2002 03:03:14 -0500
Maxim Koshelev <max krascoal ru> writes:
yeah, I've attached slightly changed list_store.c from gtk-demo part
of gtk2.
Just replace list_store.c by this file and recompile demo.
Four clicks will remove a row. Look to stderr...
if you change
gtk_list_store_remove (GTK_LIST_STORE (model), d->iter);
by
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
you'll get another warning :-)
You do:
if (click_counter==4){
gtk_list_store_remove (GTK_LIST_STORE (model), d->iter);
}
...
/* set new value */
gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_FIXED, fixed, -1);
And are getting a warning here. This is because d->iter and &iter point
to the same row. (You can put in something like:
path = gtk_tree_model_get_path (model, d->iter);
g_print ("path1:%s\n", gtk_tree_path_to_string (path));
path = gtk_tree_model_get_path (model, &iter);
g_print ("path2:%s\n", gtk_tree_path_to_string (path));
if you don't believe me[1]). After you remove d->iter, &iter is
pointing to a dead row, and cannot be used, hence your warnings[2].
While the row is valid, you are using both d->iter, and &iter fine.
A thought occurred to me, recently. Which version of GTK+ are you
using? There was a bug fixed about a month and a half ago where the
stamp was being changed in lists. Are you using GTK+ 2.0, or at least
1.3.15?
Thanks,
-Jonathan
[1] I know this leaks. Please don't anyone copy this code for real use.
[2] And no, I don't want to walk through the free list to check for
invalid iters in VALID_ITER.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]