client: Don't disconnect on receipt of object events destined for zombies

Server side objects give protocol designers exciting ways to break clients.
For example, if a client deletes an object at the same time the server is
sending an event containing a new object to that object, then we currently
silently drop that event. If a following event in the buffer from an
object that has not yet been deleted also contains a new object, the wl_map
constraint that new objects must be 1 higher than the current highest
object count is violated.  This results in a disconnect.

Instead, let's augment the zombie accounting code to keep the entire proxy
around on deletion, for both client and server generated objects.

This way we can create and immediately delete objects that are destined for
zombie proxies - thus creating zombie descendants.

We can go no further to clean this up in the client library - we can't call
a destructor because the protocol might dictate that child objects will be
automatically destroyed on the destruction of the parent.

So we turn a situation that would lead to an erroneous disconnect into one
that may or may not leak object ids depending on protocol definition.

Fixes #74
for some definition of "fix" anyway.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2021-08-13 13:29:22 -05:00
parent f736f11f99
commit c05f4f86ea
5 changed files with 218 additions and 107 deletions

View file

@ -49,4 +49,35 @@
<arg name="passer" type="object" interface="fd_passer"/>
</request>
</interface>
<interface name="noop" version="1">
<description summary="An interface that does nothing">
A trivial interface.
</description>
<request name="destroy" type="destructor"/>
</interface>
<interface name="necromancer" version="1">
<description summary="Helper for creating zombie objects">
Simple interface for generating server side objects to use in
zombie tests.
</description>
<request name="destroy" type="destructor"/>
<request name="create_server_object">
<description summary="create a new server side object">
Create a new server side object.
</description>
</request>
<event name="server_object">
<description summary="server side object">
</description>
<arg name="id" type="new_id" interface="noop" summary="server side object"/>
</event>
</interface>
</protocol>