On Wed, May 24, 2006 at 12:18:34PM -0300, John Coppens wrote: > I'm trying to get this working: > > --------------- The function > gboolean > save_one_sat(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, > gpointer data) > { > // do something > } > > --------------- Is passed to another function like this: > satlist_foreach_sat(save_one_sat); > > --------------- This function is declared as: > void satlist_foreach_sat(GtkTreeModelForeachFunc func); > > --------------- Where the actual GtkTreeModelForeach will be called: > gtk_tree_model_foreach(GTK_TREE_MODEL(sat_store), func, NULL); > > > This segfaults, and gdb says the parameter passed to satlist_foreach_sat > is actually 0x1, not the address of the save_one_sat function. I've tried > declaring save_one_sat as static, I've typecasted the save_one_sat on > passing it as parameter. I've found several tutorials on the net that did > just this...
Well, the few lines you posted seem correct. Perhaps you overwrite stack (or have other memory problem) elsewhere. Note gdb does not always display on-stack variable values right when optimizations are enabled (the the stack space is probably reused for something else). You can - disable optimizations - use plain fprintf(stderr, ...) - find out whether func is really 0x1 when it is called and when it changes to this value - try valgrind Yeti -- Anonyms eat their boogers. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list