[pygtk] problem with gnome_icon_list_get_icon_data
Sam Byrne
sam.byrne@hiscorp.net
05 Feb 2002 09:22:53 -0700
I knew there had to be something that I was doing wrong in making the
call. Interestingly enough, I was receiving a NULL pointer in the
return, so that makes perfect sense. I apologize if I ask questions
that are blatantly wrong, but I am brand new to Python as well as to
GTK/GNOME.
Thanks much for your help.
Sam
On Mon, 2002-02-04 at 19:28, James Henstridge wrote:
> Sam Byrne wrote:
>
> >I noticed in an archive that someone posted a question regarding a
> >problem that I seem to be stumped with. Please help out if you know of
> >the solution.
> >
> >(This is snipped from the archive)
> >snip----
> >I've some problems with GnomeIconList: whenever I try to access
> >get_icon_data() method python just recives segfault and the whole app
> >crashes. It's enough to do something like:
> >
> >from gnome.ui import *
> >
> >l = GnomeIconList()
> >l.append('some-icon.png', 'some text')
> >l.get_icon_data(0)
> >
> >It also 'works' in full-blown apps (i.e. with main app window, mainloop
> >running etc.).
> >snip--
> >
> >I'm messing with the code on version 1.4.1 of pygnome on redhat 7.2.
> >Tracking the issue back to its source leads me to believe that this bit
> >of code might very well be the problem:
> >
> >static PyObject *_wrap_gnome_icon_list_get_icon_data(PyObject *self,
> >PyObject *args) {
> > PyObject *ilist, *data;
> > int pos;
> >
> > if (!PyArg_ParseTuple(args, "O!i:gnome_icon_list_get_icon_data",
> > &PyGtk_Type, &ilist, &pos))
> > return NULL;
> > data =
> >gnome_icon_list_get_icon_data(GNOME_ICON_LIST(PyGtk_Get(ilist)), pos);
> > Py_INCREF(data);
> > return data;
> >}
> >
> >The call to gnome_icon_list_get_icon_data seems to return something
> >incorrect. According to the source, it should return a void pointer
> >(gpointer), but the next call(Py_INCREF) seems to cause a seg fault.
> >Any ideas???
> >
> If you didn't set the data associated with the icon, then the results
> can be unpredictable (ie. get_icon_data() will return whatever you set
> with set_icon_data()). I suppose putting in a NULL check there would be
> helpful, but you will run into the same sort of problem if the icon data
> is set to something other than a PyObject.
>
> James.
>
> --
> Email: james@daa.com.au
> WWW: http://www.daa.com.au/~james/
>
>
>
--
Network Administrator - H.I.S. Financial Services Corporation.
102 S. Tejon, Ste. 920, Colorado Springs, CO 80903
Phone: 719-633-7005x217 Fax: 719-633-7006