Desallocate replies and events properly

This commit is contained in:
Arnaud Fontaine 2008-03-30 14:46:58 +01:00 committed by Julien Danjou
parent 216f7f16f2
commit 2f9409ba74
5 changed files with 34 additions and 21 deletions

View File

@ -932,7 +932,9 @@ uicb_client_moveresize(int screen, char *arg)
if(globalconf.screens[sel->screen].resize_hints)
geometry = client_geometry_hints(sel, geometry);
client_resize(sel, geometry, false);
if (xqp && ox <= xqp->root_x && (ox + 2 * sel->border + ow) >= xqp->root_x &&
if (xqp)
{
if(ox <= xqp->root_x && (ox + 2 * sel->border + ow) >= xqp->root_x &&
oy <= xqp->root_y && (oy + 2 * sel->border + oh) >= xqp->root_y)
{
nmx = xqp->root_x - (ox + sel->border) + sel->geometry.width - ow;
@ -947,6 +949,9 @@ uicb_client_moveresize(int screen, char *arg)
XCB_NONE, sel->win,
0, 0, 0, 0, nmx, nmy);
}
p_delete(&xqp);
}
}
/** Kill a client via a WM_DELETE_WINDOW request or XKillClient if not

13
event.c
View File

@ -403,6 +403,7 @@ event_handle_keypress(void *data __attribute__ ((unused)),
* number with screen_get_bycoord: we'll get 0 in Zaphod mode
* so it's the same, or maybe the real Xinerama screen */
screen = screen_get_bycoord(globalconf.screens_info, screen, qpr->root_x, qpr->root_y);
p_delete(&qpr);
break;
}
@ -457,6 +458,9 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
p_delete(&wa);
return 0;
}
p_delete(&wa);
if(!client_get_bywin(globalconf.clients, ev->window))
{
if((wgeom = xcb_get_geometry_reply(connection,
@ -468,14 +472,15 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
xcb_query_pointer(connection,
xcb_aux_get_screen(globalconf.connection, screen_nbr)->root),
NULL)) != NULL)
screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr, qpr->root_x, qpr->root_y);
{
screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr,
qpr->root_x, qpr->root_y);
p_delete(&qpr);
}
else
for(iter = xcb_setup_roots_iterator (xcb_get_setup (connection)), screen_nbr = 0;
iter.rem && iter.data->root != wgeom->root; xcb_screen_next (&iter), ++screen_nbr);
if(qpr)
p_delete(&qpr);
client_manage(ev->window, wgeom, screen_nbr);
p_delete(&wgeom);
}

View File

@ -83,12 +83,14 @@ arrange(int screen)
xcb_query_pointer_unchecked(globalconf.connection,
xcb_aux_get_screen(globalconf.connection,
phys_screen)->root),
NULL)) != NULL
&& (xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child))
NULL)) != NULL)
{
if(xqp->root == XCB_NONE || xqp->child == XCB_NONE || xqp->root == xqp->child)
window_root_grabbuttons(phys_screen);
globalconf.pointer_x = xqp->root_x;
globalconf.pointer_y = xqp->root_y;
p_delete(&xqp);
}
/* reset status */

View File

@ -222,7 +222,6 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
mouse_resizebar_draw(ctx, style, sw, c->geometry, c->border);
xcb_aux_sync(globalconf.connection);
p_delete(&ev);
}
else
{

View File

@ -141,6 +141,8 @@ placement_under_mouse(Client *c)
{
finalgeometry.x = xqp->root_x - c->f_geometry.width / 2;
finalgeometry.y = xqp->root_y - c->f_geometry.height / 2;
p_delete(&xqp);
}
finalgeometry = titlebar_geometry_add(&c->titlebar, finalgeometry);