aboutsummaryrefslogtreecommitdiffstats
path: root/tests/queue-test.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2012-11-03 22:26:10 +0100
committerKristian Høgsberg <krh@bitplanet.net>2012-11-05 15:44:50 -0500
commite273c7cde34c23437d34732082d46aee537f6611 (patch)
treef0daa68ad8224698a465e025b4b345f586e39e32 /tests/queue-test.c
parentdoc: Remove obsolete doxygen tags (diff)
downloadwayland-e273c7cde34c23437d34732082d46aee537f6611.tar
wayland-e273c7cde34c23437d34732082d46aee537f6611.tar.gz
wayland-e273c7cde34c23437d34732082d46aee537f6611.tar.bz2
wayland-e273c7cde34c23437d34732082d46aee537f6611.tar.lz
wayland-e273c7cde34c23437d34732082d46aee537f6611.tar.xz
wayland-e273c7cde34c23437d34732082d46aee537f6611.tar.zst
wayland-e273c7cde34c23437d34732082d46aee537f6611.zip
client: Keep track of proxy validity and number of reference holders
When events are queued, the associated proxy objects (target proxy and potentially closure argument proxies) are verified being valid. However, as any event may destroy some proxy object, validity needs to be verified again before dispatching. Before this change this was done by again looking up the object via the display object map, but that did not work because a delete_id event could be dispatched out-of-order if it was queued in another queue, causing the object map to either have a new proxy object with the same id or none at all, had it been destroyed in an earlier event in the queue. Instead, make wl_proxy reference counted and increase the reference counter of every object associated with an event when it is queued. In wl_proxy_destroy() set a flag saying the proxy has been destroyed by the application and only free the proxy if the reference counter reaches zero after decreasing it. Before dispatching, verify that a proxy object still is valid by checking that the flag set in wl_proxy_destroy() has not been set. When dequeuing the event, all associated proxy objects are dereferenced and free:ed if the reference counter reaches zero. As proxy reference counter is initiated to 1, when dispatching an event it can never reach zero without having the destroyed flag set. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Diffstat (limited to 'tests/queue-test.c')
0 files changed, 0 insertions, 0 deletions