From: Thomas L. <ta...@ec...> - 2002-05-30 11:00:26
|
On Thu, May 30, 2002 at 12:17:42PM +0200, Filip Van Raemdonck wrote: > Hi, > > I don't have gtk2 handy here so I can't try it right now, but... > > On Wed, May 29, 2002 at 06:49:13PM +0100, Thomas Leonard wrote: > > > > - Unreffing the pixmap after setting the style causes a segfault, so I > > take that as a hint that we shouldn't do that. > > Yet you create a new pixmap each time and don't unref the old one (you > obviously can't anymore after you've left the callback) > Have you also tried unreffing the pixmap after unreffing the style, or did > you unref it before that? Doesn't work either way. The ref counting goes as follows (from printfs): 1. Create new pixmap (pixmap ref = 1) 2. set_style() (pixmap ref now 2) 3. unref style (pixmap ref still 2) [ wait] 4. Create new pixmap (old pixmap still has ref = 2) 5. set_style() (new = 2, old is now invalid) That is: - Setting the style increases the ref count by one. - Unsetting it decreases by two. My code therefore allows for this. Also, a refcounting error doesn't explain why: - Neither the program nor the X server grows when no window is being dragged over it. - XNest and other X servers don't seem to be affected. > How about making style and pixmap globals, creating them only once at > startup, and just only setting style in the callback instead of recreating > the pixmap and style each time? If the pixmap is only created once then there is no problem (which isn't much use for a backdrop setter ;-). -- Thomas Leonard http://rox.sourceforge.net ta...@ec... ta...@us... |