On Sun, 10 Aug 2014 15:59:08 +0200 "Nils Chr. Brause" <nilschrbra...@gmail.com> wrote:
> On Sat, Aug 9, 2014 at 3:14 PM, Pekka Paalanen <ppaala...@gmail.com> wrote: > > > But I do wonder, if it ever makes sense to check user data for > > NULL, and set if it is NULL. If user_data is NULL, how can you > > ever be sure, that the wl_proxy was created by your code, and not > > by some library you use? > > > > Even when user_data is not NULL, you should have some explicit way > > of checking whether the pointer is yours or not. > > > > If I would use any external libraries (like Qt or something), I agree that I > could not possibly trust the value of user_data, since I don't know, what > the library is doing there. > > But I'm not using any external libraries, just libwayland-client. I thought > that all proxies that are created by marshal_constructor or come from > events with new_id type arguments are created by either of these two > functions and therefore would have a NULL user_data if they got > initialised there. If this is wrong, please tell me. :) 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? 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? Thanks, pq _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel