Re: [gtk-list] Re: window icon

Havoc Pennington wrote:
> The X server holds a reference to the server-side object, so GDK
> doesn't bother to keep a client-side reference.

  But when I call gdk_pixmap_unref, it doesn't check the reference count
on the server side, it calls XFreePixmap () if its own reference count
is 0.

> In any case it shouldn't matter to you - if you're going to use the
> pixmap again _you_ must hold a reference, even if you think someone
> else already does. Them's the rules in a refcounted world.

  The problem is that I'm not going to use the pixmap again, I just set
the window icon and then I don't need it anymore. If I call:

  load_pixmap ("icon.xpm", window, &pixmap, &mask);
  gdk_window_set_icon (window->window, NULL, pixmap, mask);
  gdk_pixmap_unref (pixmap);
  gdk_pixmap_unref (mask);

  Then the icon is not set but if I remove the last 2 lines then
everything works. When the window is destroyed, does it decrease the
reference count of the GdkPixmap or should I do it myself ?


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