[PATCH 2/3] Xi: don't store the window pointer in barriers, store the window ID
Peter Hutterer
peter.hutterer at who-t.net
Wed Dec 12 21:22:06 PST 2012
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 at who-t.net>
---
Xi/xibarriers.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 7e8b2e6..1714634 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -80,7 +80,7 @@ struct PointerBarrierDevice {
struct PointerBarrierClient {
XID id;
ScreenPtr screen;
- WindowPtr window;
+ Window window;
struct PointerBarrier barrier;
struct xorg_list entry;
/* 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.dt = ms - pbd->last_timestamp;
- ev.window = c->window->drawable.id;
+ ev.window = c->window;
pbd->last_timestamp = ms;
/* root x/y is filled in later */
@@ -501,7 +501,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
ev.barrierid = c->id;
ev.dt = ms - pbd->last_timestamp;
- ev.window = c->window->drawable.id;
+ ev.window = c->window;
pbd->last_timestamp = ms;
/* root x/y is filled in later */
@@ -566,7 +566,7 @@ CreatePointerBarrierClient(ClientPtr client,
cs = GetBarrierScreen(screen);
ret->screen = screen;
- ret->window = pWin;
+ ret->window = stuff->window;
ret->num_devices = stuff->num_devices;
if (ret->num_devices > 0)
ret->device_ids = (int*)&ret[1];
@@ -656,7 +656,7 @@ BarrierFreeBarrier(void *data, XID id)
/* .deviceid */
.sourceid = 0,
.barrierid = c->id,
- .window = c->window->drawable.id,
+ .window = c->window,
.root = screen->root->drawable.id,
.dx = 0,
.dy = 0,
--
1.8.0.2
More information about the xorg-devel
mailing list