Re: [gtk-list] help with coding, pixmaps




On Sat, 12 Jun 1999, Travis Loyd wrote:
>     ptr = -1;
>     play_pix[++ptr] = gdk_pixmap_create_from_xpm_d(
>             mother->main_window->window, &play_mask[ptr],

Personally I wouldn't know what the value of "ptr" is in play_mask[ptr].
Maybe your code is OK - but maybe it isn't. You have to be a C language
lawyer to know, and anytime you have to be a language lawyer to know you
shouldn't be doing what you're doing, even if you are a language lawyer.
:-)

Anyway, a long-winded way of saying, see if it works if you move the
++ptr to a separate line. Maybe it will help.

> Is the gtk_widget_realize even necessary? What is it anyways? I added it

Owen recommends using gdk_pixmap_colormap_create_from_xpm_d() instead,
then you won't need the realize. Use gtk_widget_get_colormap() to get a
colormap. (Basically the realize call ensures the widget's GdkWindow
exists so you can pass it to the pixmap functions.)

> in later thinking it might stop the crashing... the error seems to always
> happen when trying 'gdk_bitmap_unref(play_mask[ptr])'. I have 2 linked

That would certainly be explained by ptr having the wrong value -
especially if it happens when you nuke the last pointer in the list.
Explore a bit in gdb and you should be able to tell which values are
wrong.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]