From 566e40638b8a204e38c4b9a88afbc8149ab971c6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 26 Apr 2009 15:13:41 +0200 Subject: [PATCH] tag: check that tag is not already attached before attaching (FS#509) Signed-off-by: Julien Danjou --- tag.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tag.c b/tag.c index 11941ce39..1fb1cfe5a 100644 --- a/tag.c +++ b/tag.c @@ -65,12 +65,17 @@ tag_view(tag_t *tag, bool view) void tag_append_to_screen(screen_t *s) { + tag_t *tag = luaL_checkudata(globalconf.L, -1, "tag"); + + /* can't attach a tag twice */ + if(tag->screen) + return; + int screen_index = screen_array_indexof(&globalconf.screens, s); int phys_screen = screen_virttophys(screen_index); - tag_t *tag = tag_ref(globalconf.L); tag->screen = s; - tag_array_append(&s->tags, tag); + tag_array_append(&s->tags, tag_ref(globalconf.L)); ewmh_update_net_numbers_of_desktop(phys_screen); ewmh_update_net_desktop_names(phys_screen); ewmh_update_workarea(phys_screen);