Re: Reasons for FreePicture to cause "RenderBadPicture"?

2010-08-30 Thread Glynn Clements

Clemens Eisserer wrote:

> > Pixmaps are reference-counted and the picture takes a reference on the
> > pixmap, so the pixmap can't go away before the picture.
> >
> > However this isn't true for windows, so as soon as the window is
> > destroyed presumably the picture is destroyed as well or becomes
> > invalid.
> 
> Can this be considered as bug?  I just tried the same for GCs and
> XFreeGC doesn't generate any error when the Window has already been
> destroyed.
> Sure there is an implementation detail behind it, but GCs don't show
> the same behavour and the whole thing somehow feels quite inconsistent
> :(

GCs aren't associated with a window. The drawable passed to XCreateGC
is used to specify the screen and depth, but has no significance
beyond that. A GC may be used with any drawable having the correct
screen and depth.

-- 
Glynn Clements 
___
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Re: Reasons for FreePicture to cause "RenderBadPicture"?

2010-08-30 Thread Clemens Eisserer
Hi Michel,

> Pixmaps are reference-counted and the picture takes a reference on the
> pixmap, so the pixmap can't go away before the picture.
>
> However this isn't true for windows, so as soon as the window is
> destroyed presumably the picture is destroyed as well or becomes
> invalid.

Can this be considered as bug?  I just tried the same for GCs and
XFreeGC doesn't generate any error when the Window has already been
destroyed.
Sure there is an implementation detail behind it, but GCs don't show
the same behavour and the whole thing somehow feels quite inconsistent
:(


> If you can't avoid using window pictures, it's probably best to
> make sure you destroy any pictures before the windows themselves.

I fear this would mean major refactoring, but seems the only sane way to go.

Thanks, Clemens
___
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Re: Reasons for FreePicture to cause "RenderBadPicture"?

2010-08-28 Thread Michel Dänzer
On Fre, 2010-08-27 at 21:43 +0200, Clemens Eisserer wrote: 
> Hi again,
> 
> Seems I have found the cause of the problem: Freeing Pictures that
> belong to an already destroyed window cause the RenderBadPicture
> error. The XID values in the error-log were wrong and therefor
> misleading.
> 
> What puzzles me is the inconsistent behaviour:
> When a Window is destroyed, all its associated Pictures are freed,
> however this is not the case for Pixmaps.
> Even after calling XFreePixmap the assiciated Picture-Objects stay alive.

Pixmaps are reference-counted and the picture takes a reference on the
pixmap, so the pixmap can't go away before the picture.

However this isn't true for windows, so as soon as the window is
destroyed presumably the picture is destroyed as well or becomes
invalid. If you can't avoid using window pictures, it's probably best to
make sure you destroy any pictures before the windows themselves.


-- 
Earthling Michel Dänzer   |http://www.vmware.com
Libre software enthusiast |  Debian, X and DRI developer
___
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com

Re: Reasons for FreePicture to cause "RenderBadPicture"?

2010-08-27 Thread Clemens Eisserer
Hi again,

Seems I have found the cause of the problem: Freeing Pictures that
belong to an already destroyed window cause the RenderBadPicture
error. The XID values in the error-log were wrong and therefor
misleading.

What puzzles me is the inconsistent behaviour:
When a Window is destroyed, all its associated Pictures are freed,
however this is not the case for Pixmaps.
Even after calling XFreePixmap the assiciated Picture-Objects stay alive.

Any idea whats the idea behind this inconsistency, or is it a bug?
I feel really uncomfortable relying on this behaviour in my code :/

Thank you in advance, Clemens
___
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com


Reasons for FreePicture to cause "RenderBadPicture"?

2010-08-27 Thread Clemens Eisserer
Hi,

I have some code which causes "RenderBadPicture" errors from time to
time, and I have troubles finding the cause.

I have inserted some debug code and switched to synchronous mode,
however I don't get an idea whats going wrong.
Some pictures don't seem to cause problem, whereas other pictures
cause a single or even multiple errors although only freed once in
what seems to be a free call to free a completly different picture
like FreePicture(4c00184) which results in an error for picture
4c00189.

Any ideas whats going wrong?

If the "parent" drawable the Picture belongs to (e.g. a window or
picture) is freed, are all corresponding Pictures freed automatically
and cause a RenderBadPicture when a FreePicture is later attempt?

Thank you in advance, Clemens


Free request for: 4c00102, is pixmap: 1
Freeing picture 4c00102
-
Free request for: 4c00106, is pixmap: 1
Freeing picture 4c00106
> Xerror RenderBadPicture (invalid Picture parameter), XID 4c00106, ser# 10171
> Major opcode 147 (Unknown)
> Minor opcode 7
-
Free request for: 4c000f0, is pixmap: 0
Freeing picture 4c000f0
-
Free request for: 4c00189, is pixmap: 0
Freeing picture 4c00189
> Xerror RenderBadPicture (invalid Picture parameter), XID 4c00189, ser# 20872
> Major opcode 147 (Unknown)
> Minor opcode 7
--
Free request for: 4c00184, is pixmap: 0  //Whats going on
here, I free 4c00184 and get an error for 4c00189 multiple times?
Freeing picture 4c00184
> Xerror RenderBadPicture (invalid Picture parameter), XID 4c00189, ser# 20874
> Major opcode 147 (Unknown)
> Minor opcode 7
--
Free request for: 4c00182, is pixmap: 0
Freeing picture 4c00182
> Xerror RenderBadPicture (invalid Picture parameter), XID 4c00189, ser# 20876
> Major opcode 147 (Unknown)
> Minor opcode 7
---
Free request for: 4c00180, is pixmap: 0
Freeing picture 4c00180
> Xerror RenderBadPicture (invalid Picture parameter), XID 4c00189, ser# 20878
> Major opcode 147 (Unknown)
> Minor opcode 7
___
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com