Fix possible W->client = NULL in generated client funcs

This commit is contained in:
Martin Duquesnoy 2011-09-21 22:20:33 +02:00
parent 68aecac27c
commit 07014979c1
3 changed files with 21 additions and 19 deletions

View File

@ -26,16 +26,18 @@ void uicb_client_resize_##D(Uicb cmd) \
void uicb_client_##A##_##D(Uicb cmd) \
{ \
(void)cmd; \
if(W->client) \
client_##A(client_next_with_pos(W->client, D)); \
struct client *c; \
if(W->client && (c = client_next_with_pos(W->client, D))) \
client_##A(c); \
}
#define CLIENT_ACTION_LIST(A, L) \
void uicb_client_##A##_##L(Uicb cmd) \
{ \
(void)cmd; \
if(W->client) \
client_##A(client_##L(W->client)); \
struct client *c; \
if(W->client && (c = client_##L(W->client))) \
client_##A(c); \
}
/* uicb_client_resize_dir() */
@ -122,7 +124,7 @@ client_next_with_pos(struct client *bc, Position p)
{
struct client *c;
int x, y;
const static char scanfac[PositionLast] = { +10, -10, 0, 0 };
const static char scanfac[PositionLast] = { +1, -1, 0, 0 };
/*
* Set start place of pointer (edge with position
@ -421,7 +423,6 @@ client_remove(struct client *c)
XSetErrorHandler(wmfs_error_handler);
free(c);
c = NULL;
}
void

View File

@ -54,10 +54,11 @@ client_next(struct client *c)
static inline struct client*
client_prev(struct client *c)
{
struct client *nc, *cc = SLIST_FIRST(&c->tag->clients);
struct client *cc;
while((nc = SLIST_NEXT(cc, tnext)) && nc != c)
cc = nc;
for(cc = SLIST_FIRST(&c->tag->clients);
SLIST_NEXT(cc, tnext) && SLIST_NEXT(cc, tnext) != c;
cc = SLIST_NEXT(cc, tnext));
return cc;
}

View File

@ -91,10 +91,10 @@ tag_client(struct tag *t, struct client *c)
layout_split_arrange_closed(c);
SLIST_REMOVE(&c->tag->clients, c, client, tnext);
if(c->tag->sel == c || W->client == c)
client_focus(client_next(c));
SLIST_REMOVE(&c->tag->clients, c, client, tnext);
}
/*