I think the binbuf is always present, but in the case of a top-level canvas, it might be empty; binbuf_getnatom() tells you how many atoms there are.
cheers Miller On Sun, Oct 28, 2007 at 10:14:48PM -0400, Hans-Christoph Steiner wrote: > > On Oct 28, 2007, at 8:47 PM, Martin Peach wrote: > > > Hans-Christoph Steiner wrote: > >> > >> I tried this in entry_new() and entry_save(), and in both, > >> "binbuf" ends being nothing useful (i.e. segfault): > >> > >> t_glist *glist = (t_glist *) canvas_getcurrent(); > >> t_canvas *canvas = (t_canvas*) glist_getcanvas(glist); > >> t_binbuf *binbuf = canvas->gl_obj.te_binbuf; > >> t_atom *ap = binbuf_getvec(binbuf); > >> t_symbol *classname = atom_getsymbol(ap); > >> > >> What's going on here? Am I doing something wrong? > >> > > I don't know what you're trying to do but it's normal to check for > > NULL pointers after each of the above statements. That should give > > you a clue. > > I suspect that the binbuf doesn't exist if you didn't allocate it > > yourself. > > I am just following IOhannes' code, which he says works (I haven't > tested it...) > > http://pure-data.cvs.sourceforge.net/pure-data/externals/iem/iemguts/ > src/saveargs.c?view=markup > > Somehow, he magically gets a binbuf with contents in it! ;) > > .hc > > > ------------------------------------------------------------------------ > ---- > > There is no way to peace, peace is the way. -A.J. Muste > > > > _______________________________________________ > PD-dev mailing list > [email protected] > http://lists.puredata.info/listinfo/pd-dev _______________________________________________ PD-dev mailing list [email protected] http://lists.puredata.info/listinfo/pd-dev
