Remove a possibility for lua to cause X11 errors

The lua code could keep a reference to out cairo surface for a drawin after it
was destroyed. So make sure the surface is finished before the associated
drawable is destroyed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-12-19 14:29:52 +01:00
parent da78a89dcd
commit f57dbb6a78
1 changed files with 8 additions and 5 deletions

View File

@ -61,6 +61,14 @@ drawin_systray_kickout(drawin_t *w)
static void
drawin_wipe_resources(drawin_t *w)
{
if(w->surface)
{
/* Make sure that cairo knows that this surface can't be unused anymore.
* This is needed since lua could still have a reference to it. */
cairo_surface_finish(w->surface);
cairo_surface_destroy(w->surface);
w->surface = NULL;
}
if(w->window)
{
/* Activate BMA */
@ -77,11 +85,6 @@ drawin_wipe_resources(drawin_t *w)
xcb_free_pixmap(globalconf.connection, w->pixmap);
w->pixmap = XCB_NONE;
}
if(w->surface)
{
cairo_surface_destroy(w->surface);
w->surface = NULL;
}
}
static void