From e1d6f0a150a0ca077984b38ea6b17d95948c4ab8 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 4 Sep 2009 15:10:56 +0200 Subject: [PATCH] Disconnect from the X server after closing lua Else stuff like this can happen: Invalid read of size 4: at 0x300280BB7F: (within /usr/lib/libxcb.so.1.1.0) by 0x300280BD21: xcb_get_extension_data (in /usr/lib/libxcb.so.1.1.0) by 0x300280A55A: xcb_send_request (in /usr/lib/libxcb.so.1.1.0) by 0x300C604A4F: xcb_render_free_picture (in /usr/lib/libxcb-render.so.0.0.0) by 0x300B24C4BB: (within /usr/lib/libcairo.so.2.10800.8) by 0x300B22F1B6: cairo_surface_finish (in /usr/lib/libcairo.so.2.10800.8) by 0x300B22F234: cairo_surface_destroy (in /usr/lib/libcairo.so.2.10800.8) by 0x300B218124: (within /usr/lib/libcairo.so.2.10800.8) by 0x300B212750: cairo_destroy (in /usr/lib/libcairo.so.2.10800.8) by 0x42E4D0: wibox_wipe (draw.h:110) by 0x42E568: luaA_wibox_gc (wibox.c:46) by 0x3008E0CB15: (within /usr/lib/liblua5.1.so.0.0.0) Address 0x4e56ec0 is 20,928 bytes inside a block of size 20,992 free'd at 0x4A0761F: free (vg_replace_malloc.c:323) by 0x40F974: awesome_atexit (awesome.c:97) by 0x410316: main (awesome.c:577) Signed-off-by: Uli Schlachter Signed-off-by: Julien Danjou --- awesome.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/awesome.c b/awesome.c index 157880de..37684a70 100644 --- a/awesome.c +++ b/awesome.c @@ -92,12 +92,13 @@ awesome_atexit(void) titlebar_client_detach(*c); } - xcb_flush(globalconf.connection); - - xcb_disconnect(globalconf.connection); - /* Close Lua */ lua_close(globalconf.L); + + xcb_flush(globalconf.connection); + + /* Disconnect *after* closing lua */ + xcb_disconnect(globalconf.connection); } /** Scan X to find windows to manage.