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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-05-14 16:54:33 +02:00
parent c606bc36a8
commit 2729357ad2
1 changed files with 6 additions and 6 deletions

View File

@ -60,12 +60,6 @@ drawin_wipe(drawin_t *w)
{ {
/* The drawin must already be unmapped, else it /* The drawin must already be unmapped, else it
* couldn't be garbage collected -> no unmap needed */ * 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); p_delete(&w->cursor);
if(w->surface) 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); 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);
}
} }
} }