mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
root: Do not end up in an infinite loop if the wallpaper is nil
.
If `root.wallpaper` was called with `nil` during initialization, AwesomeWM would get into an infinite restart loop.
This commit is contained in:
parent
b0a2d82d8f
commit
b9971a5acc
2 changed files with 15 additions and 1 deletions
7
root.c
7
root.c
|
@ -481,6 +481,11 @@ luaA_root_wallpaper(lua_State *L)
|
|||
{
|
||||
if(lua_gettop(L) == 1)
|
||||
{
|
||||
/* Avoid `error()s` down the line. If this happens during
|
||||
* initialization, AwesomeWM can be stuck in an infinite loop */
|
||||
if(lua_isnil(L, -1))
|
||||
return 0;
|
||||
|
||||
cairo_pattern_t *pattern = (cairo_pattern_t *)lua_touserdata(L, -1);
|
||||
lua_pushboolean(L, root_set_wallpaper(pattern));
|
||||
/* Don't return the wallpaper, it's too easy to get memleaks */
|
||||
|
@ -602,7 +607,7 @@ const struct luaL_Reg awesome_root_methods[] =
|
|||
{ "cursor", luaA_root_cursor },
|
||||
{ "fake_input", luaA_root_fake_input },
|
||||
{ "drawins", luaA_root_drawins },
|
||||
{ "wallpaper", luaA_root_wallpaper },
|
||||
{ "_wallpaper", luaA_root_wallpaper },
|
||||
{ "size", luaA_root_size },
|
||||
{ "size_mm", luaA_root_size_mm },
|
||||
{ "tags", luaA_root_tags },
|
||||
|
|
|
@ -133,6 +133,15 @@ end
|
|||
return true
|
||||
end)
|
||||
|
||||
-- Make sure passing `nil` doesn't crash Awesome.
|
||||
table.insert(steps, function()
|
||||
|
||||
root._wallpaper(nil)
|
||||
root.wallpaper(nil)
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
|
||||
runner.run_steps(steps)
|
||||
|
||||
|
|
Loading…
Reference in a new issue