client: fix icon value on changes

Sometimes we unref the icon image, but we did not reset NULL, which
can make the client refering to a not-refed image.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-06-18 12:13:00 +02:00
parent 0eee6795df
commit b811880c54
2 changed files with 3 additions and 0 deletions

View File

@ -1460,6 +1460,7 @@ luaA_client_newindex(lua_State *L)
break;
case A_TK_ICON:
image_unref(L, c->icon);
c->icon = NULL;
c->icon = image_ref(L, 3);
/* execute hook */
hook_property(client, c, "icon");

View File

@ -356,6 +356,8 @@ property_handle_net_wm_icon(void *data,
image_unref(globalconf.L, c->icon);
if(ewmh_window_icon_from_reply(reply))
c->icon = image_ref(globalconf.L, -1);
else
c->icon = NULL;
/* execute hook */
hook_property(client, c, "icon");
}