XCB_DESTROY_NOTIFY & SIGTERM

Uli Schlachter psychon at znc.in
Wed Dec 4 17:32:06 UTC 2024


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 143 
> is a SIGTERM code. First time I received this and a non-xcb source 
> claims this is so.

Uhm. No idea what this source is, but it is wrong. What would be a 
SIGTERM error?

The core X11 protocol (the stuff from xproto.h) has "hardcoded" error 
numbers. These are errors 1 to 17. The error codes for extensions are 
dynamically assigned at runtime and need to be looked up with 
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 >= the error 
code we are interested in. In my case, error 143 would be the base code 
of RENDER (142) + 1. With this information I can now check what error 1 
in the RENDER extension is, which would be BadPicture. I looked this up 
in xcb-proto's XML description:

   <error name="PictFormat" number="0" />

> I got the error on a 2 window 'app' after the XCB_DESTROY_NOTIFY of the 
> first window. It appears only after what I'm guessing was a 'complete' 
> clean up of first window's resources. By this I mean the 'last 
> reference' to a cairo_surface_t is destroyed. I can comment out the 
> 'finish/destroy' code to not receive code 143. I also assume I would get 
> this code on a single window 'app', but don't see because on 
> 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 
> X-server correctly terminated the 'process' of the first window, and 
> 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 
actually makes sense. Cairo tried to do something, but the window was 
already destroyed, so the picture for it was destroyed as well. So it 
causes a BadPicture error.

How come you only get XCB_DESTROY_NOTIFY for your window? Normally, one 
uses the WM_DELETE_WINDOW to get a notification and destroy the window 
oneself. That way, you can clean up your cairo resources before the 
window is gone.

Cheers,
Uli

-- 
“I’m Olaf and I like warm hugs.”


More information about the Xcb mailing list