Re: XCB_DESTROY_NOTIFY & SIGTERM
Uli Schlachter <[email protected]> Wed, 4 Dec 2024 18:32:06 +0100
| Newsgroups | gmane.comp.freedesktop.xcb |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Am 04.12.24 um 14:37 schrieb Steven J Abner:
> Hoping to clarify or ensure that a xcb_generic_error_t error_code of 14=
3=20
> is a SIGTERM code. First time I received this and a non-xcb source=20
> claims this is so.
Uhm. No idea what this source is, but it is wrong. What would be a=20
SIGTERM error?
The core X11 protocol (the stuff from xproto.h) has "hardcoded" error=20
numbers. These are errors 1 to 17. The error codes for extensions are=20
dynamically assigned at runtime and need to be looked up with=20
QueryExtension. Example for my current X11 server:
$ xdpyinfo -queryExtensions | grep 'base error'
DAMAGE (opcode: 143, base event: 91, base error: 152)
DOUBLE-BUFFER (opcode: 145, base error: 153)
GLX (opcode: 152, base event: 95, base error: 158)
MIT-SHM (opcode: 130, base event: 65, base error: 128)
RANDR (opcode: 140, base event: 89, base error: 147)
RECORD (opcode: 146, base error: 154)
RENDER (opcode: 139, base error: 142)
SECURITY (opcode: 137, base event: 86, base error: 138)
SYNC (opcode: 134, base event: 83, base error: 134)
XFIXES (opcode: 138, base event: 87, base error: 140)
XFree86-DGA (opcode: 154, base event: 112, base error: 179)
XFree86-VidModeExtension (opcode: 153, base error: 172)
XInputExtension (opcode: 131, base event: 66, base error: 129)
XKEYBOARD (opcode: 135, base event: 85, base error: 137)
XVideo (opcode: 151, base event: 93, base error: 155)
I now have to check for the highest "base error" that is >=3D the error=20
code we are interested in. In my case, error 143 would be the base code=20
of RENDER (142) + 1. With this information I can now check what error 1=20
in the RENDER extension is, which would be BadPicture. I looked this up=20
in xcb-proto's XML description:
<error name=3D"PictFormat" number=3D"0" />
> I got the error on a 2 window 'app' after the XCB_DESTROY_NOTIFY of the=
=20
> first window. It appears only after what I'm guessing was a 'complete'=20
> clean up of first window's resources. By this I mean the 'last=20
> reference' to a cairo_surface_t is destroyed. I can comment out the=20
> 'finish/destroy' code to not receive code 143. I also assume I would ge=
t=20
> this code on a single window 'app', but don't see because on=20
> XCB_DESTROY_NOTIFY I exit the event loop and disconnect.
> If the non-xcb source is to be believed, the 143 SIGTERM is stating the=
=20
> X-server correctly terminated the 'process' of the first window, and=20
> only resources for the second window remain.
> Is this a correct interpretation of signals?
Assuming error 143 is also RENDER's BadPicture error code for you, this=20
actually makes sense. Cairo tried to do something, but the window was=20
already destroyed, so the picture for it was destroyed as well. So it=20
causes a BadPicture error.
How come you only get XCB_DESTROY_NOTIFY for your window? Normally, one=20
uses the WM_DELETE_WINDOW to get a notification and destroy the window=20
oneself. That way, you can clean up your cairo resources before the=20
window is gone.
Cheers,
Uli
--=20
=E2=80=9CI=E2=80=99m Olaf and I like warm hugs.=E2=80=9D