From 2729357ad2896eb3288ef8bd3af37f8f60f29172 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 14 May 2011 16:54:33 +0200 Subject: [PATCH] Fix possible crash on shutdown (FS#904) Open some windows, select a layout which does something (=not floating) and restart awesome. It's likely that it will crash during the shutdown. The reason is that awesome cleans up various state before going down. This is mostly all the lua state. However, drawin_wipe, which is called for cleaning up after a drawin, dared to emit a sigal which then let various lua code run which had access to objects which were already destroyed. Various bad things can happen this way, in this situation it was a crash when an already-destroyed client was resized. The fix is to move the signal out of drawin_wipe. It doesn't belong there anyway. Instead, property::workarea should be emitted when the drawin's visible property changes as this is when the workarea changes, too (screen_area_get() only looks at visible drawins). Signed-off-by: Uli Schlachter --- objects/drawin.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/objects/drawin.c b/objects/drawin.c index 0ba028c4e..61f54b282 100644 --- a/objects/drawin.c +++ b/objects/drawin.c @@ -60,12 +60,6 @@ drawin_wipe(drawin_t *w) { /* The drawin must already be unmapped, else it * couldn't be garbage collected -> no unmap needed */ - if(strut_has_value(&w->strut)) - { - screen_t *screen = - screen_getbycoord(w->geometry.x, w->geometry.y); - screen_emit_signal(globalconf.L, screen, "property::workarea", 0); - } p_delete(&w->cursor); if(w->surface) { @@ -330,6 +324,12 @@ drawin_set_visible(lua_State *L, int udx, bool v) } luaA_object_emit_signal(L, udx, "property::visible", 0); + if(strut_has_value(&drawin->strut)) + { + screen_t *screen = + screen_getbycoord(drawin->geometry.x, drawin->geometry.y); + screen_emit_signal(globalconf.L, screen, "property::workarea", 0); + } } }