1. 10 Sep, 2019 1 commit
    • Simon Ser's avatar
      tests: fix memory leak in proxy-test · be23e1ab
      Simon Ser authored
      When running tests with ASan, proxy-test fails at the proxy_tag test:
      
          ==27843==ERROR: LeakSanitizer: detected memory leaks
      
          Direct leak of 32 byte(s) in 1 object(s) allocated from:
              #0 0x7f65a732dada in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:144
              #1 0x7f65a71cb3ea in wl_display_add_protocol_logger src/wayland-server.c:1813
              #2 0x557c640c0980 in proxy_tag tests/proxy-test.c:104
              #3 0x557c640c1159 in run_test tests/test-runner.c:153
              #4 0x557c640c1e2e in main tests/test-runner.c:337
              #5 0x7f65a6ea0ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
      
          SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
      
      Destroying the logger fixes the leak.
      Signed-off-by: Simon Ser's avatarSimon Ser <contact@emersion.fr>
      Fixes: 493ab79b ("proxy: Add API to tag proxy objects")
      be23e1ab
  2. 06 Sep, 2019 6 commits
  3. 05 Sep, 2019 1 commit
  4. 26 Aug, 2019 1 commit
    • Liu Wenlong's avatar
      server: Fix fake "Address already in use" error · 152c9ed9
      Liu Wenlong authored
      In the current workflow, socket file will be deleted if it already exists.
      However, if the socket file is a symbolic link and the file that it refers
      to doesn't exist, we will got "Address already in use" because bind()
      thinks the socket file exists and won't create it.
      
      Now, use lstat() to determine whether the socket file exists.
      Signed-off-by: Liu Wenlong's avatarLiu Wenlong <liuwl.fnst@cn.fujitsu.com>
      152c9ed9
  5. 17 Aug, 2019 1 commit
    • Drew DeVault's avatar
      Improve description of wl_surface · 17e49ba8
      Drew DeVault authored
      The original text makes some assumptions about surfaces which may not be
      true and fails to capture some details which are important to the
      essential traits of a wl_surface.
      17e49ba8
  6. 05 Aug, 2019 1 commit
  7. 30 Jul, 2019 1 commit
    • Drew DeVault's avatar
      Document unusual wl_registry.bind new_id behavior · a2f1343b
      Drew DeVault authored
      When wayland-scanner encounters a new_id field with no corresponding
      interface name defined, instead of emitting a function whose signature
      lines up with the usual case (a uint32_t ID), it adds the interface name
      as a string and the version number so that the interface can be
      identified from the protcol message.
      
      Without docs, this was previously left for the interprid wire protocol
      implementor (e.g. me an hour ago) to discover when Wayland clients send
      them apparently bogus messages.
      
      I would have preferred if a different primitive type were used here
      (e.g. typed_new_id) to reflect the fact that the wire protocol is
      different, but I felt it unwise to add a new primitive to wayland.xml in
      $current_year.
      a2f1343b
  8. 29 Jul, 2019 1 commit
    • Jonas Ådahl's avatar
      proxy: Add API to tag proxy objects · 493ab79b
      Jonas Ådahl authored
      When an application and a toolkit share the same Wayland connection,
      it will receive events with each others objects. For example if the
      toolkit manages a set of surfaces, and the application another set, if
      both the toolkit and application listen to pointer focus events,
      they'll receive focus events for each others surfaces.
      
      In order for the toolkit and application layers to identify whether a
      surface is managed by itself or not, it cannot only rely on retrieving
      the proxy user data, without going through all it's own proxy objects
      finding whether it's one of them.
      
      By adding the ability to "tag" a proxy object, the toolkit and
      application can use the tag to identify what the user data pointer
      points to something known.
      
      To create a tag, the recommended way is to define a statically allocated
      constant char array containing some descriptive string. The tag will be
      the pointer to the non-const pointer to the beginning of the array.
      
      For example, to identify whether a focus event is for a surface managed
      by the code in question:
      
      	static const char *my_tag = "my tag";
      
      	static void
      	pointer_enter(void *data,
      		      struct wl_pointer *wl_pointer,
      		      uint32_t serial,
      		      struct wl_surface *surface,
      		      wl_fixed_t surface_x,
      		      wl_fixed_t surface_y)
      	{
      		struct window *window;
      		const char * const *tag;
      
      		tag = wl_proxy_get_tag((struct wl_proxy *) surface);
      
      		if (tag != &my_tag)
      			return;
      
      		window = wl_surface_get_user_data(surface);
      
      		...
      	}
      
      	...
      
      	static void
      	init_window_surface(struct window *window)
      	{
      		struct wl_surface *surface;
      
      		surface = wl_compositor_create_surface(compositor);
      		wl_surface_set_user_data(surface, window);
      		wl_proxy_set_tag((struct wl_proxy *) surface,
      				 &my_tag);
      	}
      Signed-off-by: Jonas Ådahl's avatarJonas Ådahl <jadahl@gmail.com>
      493ab79b
  9. 21 Jul, 2019 1 commit
  10. 09 Jul, 2019 2 commits
    • Manuel Stoeckl's avatar
      connection: do not abort when dup(fd) fails · 9d63c9ff
      Manuel Stoeckl authored
      Instead, cleanly exit wl_closure_marshal and let the caller handler
      the error. For wayland-client, the sole calling function will call
      wl_abort() anyway. For wayland-server, the calling function will
      cleanly shutdown the client.
      
      This change ensures that compositors run with low file descriptor
      limits or internal leaks need not crash suddenly (and sometimes
      far from the problem) when space runs out.
      Signed-off-by: default avatarManuel Stoeckl <code@mstoeckl.com>
      9d63c9ff
    • Scott Anderson's avatar
      wayland.xml: Make releases for multiple 'wl_surface.attach' undefined · a2817833
      Scott Anderson authored
      Fixes #46
      
      The way wl_buffer is specified makes this situation inherently racy,
      meaning there is no way this can be done unambiguously. Current real
      compositor implementations already have differing behaviour for this, so
      any client relying on it was already broken, if any such client exists.
      
      This specifically only singles out wl_buffer.release as being undefined;
      every other aspect of it should still be valid. This is so existing and
      correct uses of multiple attaches are still valid, where a
      "static"/immutable wl_buffer is being used (i.e. they don't care about
      the release event).
      Signed-off-by: Scott Anderson's avatarScott Anderson <scott.anderson@collabora.com>
      a2817833
  11. 05 Jul, 2019 1 commit
  12. 05 Jun, 2019 2 commits
  13. 31 May, 2019 1 commit
    • orbea's avatar
      Add a missing -pthread to fix compile with slibtool. · 2485a5c2
      orbea authored
      When compiling wayland with slibtool instead of GNU libtool
      it will fail building libtest_runner with an undefined
      reference to pthread_join@@GLIBC_2.2.5. This is because
      -pthread (Or -lpthread) is missing from display_test. If its
      added the build succeeds as expected with slibtool and
      continues to work with libtool. Its likely that libtool is
      hiding this failure by silently adding the missing flag which
      is not uncommon...
      
      Exposed in commit aa51a833.
      
      Fixes #91Signed-off-by: orbea's avatarorbea <orbea@riseup.net>
      2485a5c2
  14. 02 May, 2019 3 commits
    • Antonio Borneo's avatar
      log: remove "%m" from format strings by using strerror(errno) · 294ed97e
      Antonio Borneo authored
      The printf() format specifier "%m" is a glibc extension to print
      the string returned by strerror(errno). While supported by other
      libraries (e.g. uClibc and musl), it is not widely portable.
      
      In Wayland code the format string is often passed to a logging
      function that calls other syscalls before the conversion of "%m"
      takes place. If one of such syscall modifies the value in errno,
      the conversion of "%m" will incorrectly report the error string
      corresponding to the new value of errno.
      
      Remove all the occurrences of the specifier "%m" in Wayland code
      by using directly the string returned by strerror(errno).
      Signed-off-by: Antonio Borneo's avatarAntonio Borneo <borneo.antonio@gmail.com>
      294ed97e
    • Manuel Stoeckl's avatar
      tests: Verify that wayland_scanner can catch bad identifiers · 6db761d1
      Manuel Stoeckl authored
      The test runs wayland_scanner on a set of XML protocol files which
      have malformed element names, and confirms that an error is produced
      and indicates the correct line.
      
      Copyright notifications are not included in the test files, as
      they are not code; of course, the project license still applies.
      Signed-off-by: default avatarManuel Stoeckl <code@mstoeckl.com>
      6db761d1
    • Manuel Stoeckl's avatar
      scanner: error when element names will not compile · 6ce4bbb3
      Manuel Stoeckl authored
      This change checks that the "name" fields of the various structures in
      a Wayland protocol XML file will be converted into C identifiers that
      can be successfully compiled.
      
      For names which will be inserted as the prefix of an identifier
      enforce a match with [_a-zA-Z][_0-9a-zA-Z]* . For types only inserted
      as the suffix of an identifier (enum, entry), enforce a format of
      [_0-9a-zA-Z]+ .
      
      Unicode characters (and escape sequences like \u0394) are not allowed,
      because most older and some newer C compilers do not support them by
      default.
      
      For sake of simplicity, this patch does not check for collisions
      with reserved words or standard library names.
      Signed-off-by: default avatarManuel Stoeckl <code@mstoeckl.com>
      6ce4bbb3
  15. 27 Apr, 2019 1 commit
  16. 19 Apr, 2019 2 commits
  17. 12 Apr, 2019 1 commit
  18. 11 Apr, 2019 2 commits
  19. 08 Apr, 2019 1 commit
  20. 06 Apr, 2019 1 commit
  21. 21 Mar, 2019 1 commit
  22. 14 Mar, 2019 1 commit
  23. 13 Mar, 2019 3 commits
  24. 07 Mar, 2019 2 commits
  25. 05 Mar, 2019 1 commit
  26. 25 Feb, 2019 1 commit
    • Leonid Bobrov via wayland-devel's avatar
      tests: fix main symbol duplication · c70fd8a8
      Leonid Bobrov via wayland-devel authored
      So far I got these errors before patching:
      
      libtool: link: cc -o .libs/headers-test -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/headers-test.o tests/headers-protocol-test.o tests/headers-protocol-core-test.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
      ld: error: duplicate symbol: main
      >>> defined at headers-test.c:53 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/headers-test.c:53)
      >>>            tests/headers-test.o:(main)
      >>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
      >>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a
      
      libtool: link: cc -o .libs/exec-fd-leak-checker -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/exec-fd-leak-checker.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
      ld: error: duplicate symbol: main
      >>> defined at exec-fd-leak-checker.c:57 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/exec-fd-leak-checker.c:57)
      >>>            tests/exec-fd-leak-checker.o:(main)
      >>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
      >>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a
      
      Makefile.am: error: object 'tests/test-helpers.$(OBJEXT)' created both with libtool and without
      
      libtool: link: cc -o .libs/fixed-benchmark -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/fixed-benchmark.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
      ld: error: duplicate symbol: main
      >>> defined at fixed-benchmark.c:100 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/fixed-benchmark.c:100)
      >>>            tests/fixed-benchmark.o:(main)
      >>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
      >>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a
      
      This commit fixes all of that.
      Signed-off-by: Leonid Bobrov's avatarLeonid Bobrov <mazocomp@disroot.org>
      Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      c70fd8a8