[PATCH wayland v2] assert if a listener function is NULL

Ryo Munakata ryomnktml at gmail.com
Wed Oct 1 05:19:20 PDT 2014


On Wed, 1 Oct 2014 14:49:33 +0300
Giulio Camuffo <giuliocamuffo at gmail.com> wrote:

> 2014-10-01 14:36 GMT+03:00 Ryo Munakata <ryomnktml at gmail.com>:
> > Signed-off-by: Ryo Munakata <ryomnktml at gmail.com>
> > ---
> >  src/connection.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/src/connection.c b/src/connection.c
> > index f292853..424edd4 100644
> > --- a/src/connection.c
> > +++ b/src/connection.c
> > @@ -931,6 +931,11 @@ wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
> >                      count + 2, &ffi_type_void, ffi_types);
> >
> >         implementation = target->implementation;
> > +       if (!implementation[opcode]) {
> > +               wl_log("listener function for opcode %u of %s is NULL\n",
> > +                       opcode, target->interface->name);
> > +               assert(implementation[opcode] != NULL);
> 
> Isn't it better to call abort() then, instead of assert? With the
> assert release builds will continue to segfault as before, and debug
> builds will check something which we already checked before.
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel

That makes sense.
I sent the version 3 of the patch.

Thanks.
-- 
Ryo Munakata <ryomnktml at gmail.com>


More information about the wayland-devel mailing list