[PATCH wayland] tests/resources-test: Fix wl_resource_post_event call

Mariusz Ceier mceier+wayland at gmail.com
Mon Jan 6 06:34:07 PST 2014


I think both patches (and original code too obviously) are wrong -
WL_DISPLAY_ERROR (opcode 0) event has signature "ous", so Quentin
patch calls event with too many arguments and ignores types, and Marek
patch calls event with too few arguments and incorrect type for the
second argument.
Imo, correct invocation should be either:
  wl_resource_post_event(res, WL_DISPLAY_ERROR, res,
WL_DISPLAY_ERROR_INVALID_OBJECT,"This error will be ignored");
or
  wl_resource_post_event(res, WL_DISPLAY_ERROR, NULL,
WL_DISPLAY_ERROR_INVALID_OBJECT,"This error will be ignored");
am I right ?


On 6 January 2014 14:59, Marek Ch <mchqwerty at gmail.com> wrote:
> The call is wrong, I posted it here:
> http://lists.freedesktop.org/archives/wayland-devel/2013-November/012141.html
> But without any reaction. Good that somobody else renewed it :)
>
> On 05/01/2014, Quentin Glidic <sardemff7+wayland at sardemff7.net> wrote:
>> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>>
>> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
>> ---
>>
>> I do not know if this call is wrong of this the test just reveals a bug but
>> without this, the wl_resource_post_event_array is called with random values
>>
>>  tests/resources-test.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/resources-test.c b/tests/resources-test.c
>> index d7a428a..2428964 100644
>> --- a/tests/resources-test.c
>> +++ b/tests/resources-test.c
>> @@ -108,7 +108,7 @@ TEST(destroy_res_tst)
>>       wl_resource_add_destroy_listener(res, &destroy_listener);
>>
>>       /* without implementation this should be ignored .. */
>> -     wl_resource_post_event(res, 0);
>> +     wl_resource_post_event(res, 0, 0, 0, 0, 0);
>>
>>       id = wl_resource_get_id(res);
>>       link = wl_resource_get_link(res);
>> --
>> 1.8.5.2
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list