Hello t...@!
I occasionally get cwm crashes with this backtrace:
(gdb) bt
#0 0x0d67ed04 in L2 () from /usr/lib/libc.so.53.1
#1 0x1c003be6 in client_setname (cc=0x84d47000) at
/usr/xenocara/app/cwm/client.c:531
#2 0x1c00712e in xev_loop () at /usr/xenocara/app/cwm/xevents.c:439
#3 0x1c002801 in main (argc=1, argv=0x3c005b98) at
/usr/xenocara/app/cwm/calmwm.c:92
(gdb) frame 1
#1 0x1c003be6 in client_setname (cc=0x84d47000) at
/usr/xenocara/app/cwm/client.c:531
531 if (strcmp(wn->name, newname) == 0) {
#1 0x1c003be6 in client_setname (cc=0x84d47000) at
/usr/xenocara/app/cwm/client.c:531
wn = (struct winname *) 0x8b11e850
newname = 0x863b5a40 "excalibur.wilab:p7:~ -- vim
dev/openbsd/pmemrange.diff"
(gdb) print *wn
$3 = {entry = {tqe_next = 0x8b11e8c0, tqe_prev = 0x8b11e900},
name = 0x2200003 <Address 0x2200003 out of bounds>}
So I changed client_setname() to allocate zeroed memory to avoid that
weirdness (couldn't find another clue of weird behaviour):
Index: client.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.74
diff -u -p -r1.74 client.c
--- client.c 2 Feb 2010 19:28:46 -0000 1.74
+++ client.c 22 Mar 2010 22:54:00 -0000
@@ -535,7 +535,7 @@ client_setname(struct client_ctx *cc)
goto match;
}
- wn = xmalloc(sizeof(*wn));
+ wn = xcalloc(1, sizeof(*wn));
wn->name = newname;
TAILQ_INSERT_TAIL(&cc->nameq, wn, entry);
cc->nameqlen++;
Works fine for me now (not sure though).
---
And another one,
this performs a 'group switch' on choosing a window from other group in
the menu.
(maybe this is appropriate to make an option, what do you think?)
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.115
diff -u -p -r1.115 calmwm.h
--- calmwm.h 27 Jan 2010 03:04:50 -0000 1.115
+++ calmwm.h 22 Mar 2010 22:54:00 -0000
@@ -496,6 +496,8 @@ void group_init(struct screen_ctx
*);
void group_make_autogroup(struct conf *, char *, int);
void group_update_names(struct screen_ctx *);
void group_hidetoggle(struct screen_ctx *, int);
+void group_hide(struct screen_ctx *, struct group_ctx *);
+void group_show(struct screen_ctx *, struct group_ctx *);
void group_only(struct screen_ctx *, int);
void group_cycle(struct screen_ctx *, int);
void group_sticky(struct client_ctx *);
Index: group.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.43
diff -u -p -r1.43 group.c
--- group.c 15 Dec 2009 04:10:42 -0000 1.43
+++ group.c 22 Mar 2010 22:54:00 -0000
@@ -34,8 +34,6 @@
static void group_add(struct group_ctx *, struct client_ctx *);
static void group_remove(struct client_ctx *);
-static void group_hide(struct screen_ctx *, struct group_ctx *);
-static void group_show(struct screen_ctx *, struct group_ctx *);
static void group_fix_hidden_state(struct group_ctx *);
static void group_setactive(struct screen_ctx *, long);
static void group_set_names(struct screen_ctx *);
@@ -82,7 +80,7 @@ group_remove(struct client_ctx *cc)
cc->group = NULL;
}
-static void
+void
group_hide(struct screen_ctx *sc, struct group_ctx *gc)
{
struct client_ctx *cc;
@@ -100,7 +98,7 @@ group_hide(struct screen_ctx *sc, struct
gc->hidden = 1; /* XXX: equivalent to gc->nhidden > 0 */
}
-static void
+void
group_show(struct screen_ctx *sc, struct group_ctx *gc)
{
struct client_ctx *cc;
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.50
diff -u -p -r1.50 kbfunc.c
--- kbfunc.c 15 Dec 2009 04:10:42 -0000 1.50
+++ kbfunc.c 22 Mar 2010 22:54:00 -0000
@@ -155,6 +155,13 @@ kbfunc_client_search(struct client_ctx *
if ((mi = menu_filter(sc, &menuq, "window", NULL, 0,
search_match_client, search_print_client)) != NULL) {
cc = (struct client_ctx *)mi->ctx;
+
+ if (sc->group_active && cc->group
+ && (cc->group != sc->group_active)) {
+ group_hide(sc, sc->group_active);
+ group_show(sc, cc->group);
+ }
+
if (cc->flags & CLIENT_HIDDEN)
client_unhide(cc);