Xi: don't store the window pointer in barriers, store the window ID

When a client shuts down and resources are being freed, the window may have
been freed already, so accessing it to get the window ID is bad. Plus, we
never care about the window anyway other than for stuffing it into the
event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
This commit is contained in:
Peter Hutterer 2012-12-13 14:04:13 +10:00
parent f71c2f895c
commit e2423b627e

View File

@ -80,7 +80,7 @@ struct PointerBarrierDevice {
struct PointerBarrierClient { struct PointerBarrierClient {
XID id; XID id;
ScreenPtr screen; ScreenPtr screen;
WindowPtr window; Window window;
struct PointerBarrier barrier; struct PointerBarrier barrier;
struct xorg_list entry; struct xorg_list entry;
/* num_devices/device_ids are devices the barrier applies to */ /* num_devices/device_ids are devices the barrier applies to */
@ -467,7 +467,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
ev.barrierid = c->id; ev.barrierid = c->id;
ev.dt = ms - pbd->last_timestamp; ev.dt = ms - pbd->last_timestamp;
ev.window = c->window->drawable.id; ev.window = c->window;
pbd->last_timestamp = ms; pbd->last_timestamp = ms;
/* root x/y is filled in later */ /* root x/y is filled in later */
@ -501,7 +501,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
ev.barrierid = c->id; ev.barrierid = c->id;
ev.dt = ms - pbd->last_timestamp; ev.dt = ms - pbd->last_timestamp;
ev.window = c->window->drawable.id; ev.window = c->window;
pbd->last_timestamp = ms; pbd->last_timestamp = ms;
/* root x/y is filled in later */ /* root x/y is filled in later */
@ -566,7 +566,7 @@ CreatePointerBarrierClient(ClientPtr client,
cs = GetBarrierScreen(screen); cs = GetBarrierScreen(screen);
ret->screen = screen; ret->screen = screen;
ret->window = pWin; ret->window = stuff->window;
ret->num_devices = stuff->num_devices; ret->num_devices = stuff->num_devices;
if (ret->num_devices > 0) if (ret->num_devices > 0)
ret->device_ids = (int*)&ret[1]; ret->device_ids = (int*)&ret[1];
@ -656,7 +656,7 @@ BarrierFreeBarrier(void *data, XID id)
/* .deviceid */ /* .deviceid */
.sourceid = 0, .sourceid = 0,
.barrierid = c->id, .barrierid = c->id,
.window = c->window->drawable.id, .window = c->window,
.root = screen->root->drawable.id, .root = screen->root->drawable.id,
.dx = 0, .dx = 0,
.dy = 0, .dy = 0,