XCB_DESTROY_NOTIFY & SIGTERM
Uli Schlachter
psychon at znc.in
Wed Dec 4 19:21:45 UTC 2024
Hi,
Am 04.12.24 um 20:00 schrieb Steven J Abner:
> On Wed, Dec 4 2024 at 05:32:06 PM +0000, Uli Schlachter <psychon at znc.in>
> wrote:
>> 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.
>
> On WM_DELETE_WINDOW:
> /* check transients, appropriate branch */
> xcb_unmap_window(connection, window);
> /* user save stuff, non-transient */
> xcb_destroy_window(connection, window);
> xcb_flush(connection);
> which yields a XCB_DESTROY_NOTIFY at which point:
> free/destroy data that was attached to destroy->window (event), from list.
>
> But what you are implying is that cairo is wrong in that "The caller
> owns the surface and should call cairo_surface_destroy() when done with
> it.", and it's owned by xcb?
> Easy enuf to move after user save, I think?. Would create 2 locations
> for resource deletion. Maybe a cairo ownership issue? Insights, on cairo
> if any?
I am not sure about what you are implying with ownership, but (with my
cairo hat on), I would claim that you have to (at least)
cairo_surface_finish() before the drawable is destroyed. It might also
be possible to just flush it, but I would not count on it.
Uli
P.S.: cairo_surface_destroy() implicitly calls cairo_surface_finish()
when the reference count hits zero.
--
“I’m Olaf and I like warm hugs.”
More information about the Xcb
mailing list