[PATCH] wayland-client: Initialize newly created wl_proxys to zero.

Nils Chr. Brause nilschrbrause at gmail.com
Mon Aug 11 09:12:20 PDT 2014


On Mon, Aug 11, 2014 at 8:39 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote

>  No, I do not think that is wrong, but are you not writing language
> bindings or a wrapper library, which means you do not know how your code
> will be used?
>

Yes, I'm writing C++ Bindings. These bindings don't expose the user_data at
all,
because in C++ you can assign class member functions (or even lambda
closures) as event handlers, which have access to their class instance
without
the need of a user user data void pointer. Therefore, the user should not
be able
to mess with it. ;)


> I still do not understand why you would ever really need to check if
> user_data is set on a proxy or not. When you create a wl_proxy by
> sending a request, I would suggest to always set user_data, so it will
> never be unset by you. For events, you know, that a new_id in an event
> will always be a new wl_proxy and the user_data is unset, so you can
> unconditionally set it. Again, never unset by you. Would that also help?
>

Yes. Actually I'm doing exactly this as at the moment. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140811/763ccba0/attachment.html>


More information about the wayland-devel mailing list