[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

wayland: Changes to 'upstream-unstable'



 configure.ac                          |    2 
 doc/publican/publican.cfg             |    1 
 doc/publican/sources/Foreword.xml     |   13 ++---
 doc/publican/sources/Introduction.xml |    2 
 doc/publican/sources/Protocol.xml     |   85 ++++++++++++++++++++++++++++++----
 protocol/wayland.xml                  |   18 +++----
 src/scanner.c                         |   33 ++++++++++---
 src/wayland-client.c                  |   23 ++++-----
 src/wayland-server.c                  |   22 +++-----
 wayland-scanner.m4                    |    2 
 10 files changed, 141 insertions(+), 60 deletions(-)

New commits:
commit 0df6d81aeecc0d5a52ee8ec228f743836aa24448
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Thu Aug 22 11:29:45 2013 -0700

    Bump version to 1.2.1

diff --git a/configure.ac b/configure.ac
index 536df9e..8dfd721 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
 
 m4_define([wayland_major_version], [1])
 m4_define([wayland_minor_version], [2])
-m4_define([wayland_micro_version], [0])
+m4_define([wayland_micro_version], [1])
 m4_define([wayland_version],
           [wayland_major_version.wayland_minor_version.wayland_micro_version])
 

commit 98bbbac295f002f7525f1b202f9b8187ee680f11
Author: Jason Ekstrand <jason@jlekstrand.net>
Date:   Sun Aug 18 16:53:54 2013 -0500

    doc: Add a section on interface and protocol object versioning
    
    There have been a lot of questions asked lately about versioning of
    interfaces and protocol objects.  This addition to the documentation should
    clear up some of those questions.
    
    Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>

diff --git a/doc/publican/sources/Protocol.xml b/doc/publican/sources/Protocol.xml
index 74f2aea..b79b6be 100644
--- a/doc/publican/sources/Protocol.xml
+++ b/doc/publican/sources/Protocol.xml
@@ -164,6 +164,67 @@
     </para>
   </section>
   <xi:include href="ProtocolInterfaces.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+  <section id="sect-Protocol-Versioning">
+    <title>Versioning</title>
+    <para>
+      Every interface is versioned and every protocol object implements a
+      particular version of its interface.  For global objects, the maximum
+      version supported by the server is advertised with the global and the
+      actual verion of the created protocol object is determined by the
+      version argument passed to wl_registry.bind().  For objects that are
+      not globals, their version is inferred from the object that created
+      them.
+    </para>
+    <para>
+      In order to keep things sane, this has a few implications for
+      interface versions:
+      <itemizedlist>
+	<listitem>
+	  <para>
+	    The object creation hierarchy must be a tree.  Otherwise,
+	    infering object versions from the parent object becomes a much
+	    more difficult to properly track.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    When the version of an interface increases, so does the version
+	    of its parent (recursively until you get to a global interface)
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    A global interface's version number acts like a counter for all
+	    of its child interfaces.  Whenever a child interface gets
+	    modified, the global parent's interface version number also
+	    increases (see above).  The child interface then takes on the
+	    same version number as the new version of its parent global
+	    interface.
+	  </para>
+	</listitem>
+      </itemizedlist>
+    </para>
+    <para>
+      To illustrate the above, consider the wl_compositor interface.  It
+      has two children, wl_surface and wl_region.  As of wayland version
+      1.2, wl_surface and wl_compositor are both at version 3.  If
+      something is added to the wl_region interface, both wl_region and
+      wl_compositor will get bumpped to version 4.  If, afterwards,
+      wl_surface is changed, both wl_compositor and wl_surface will be at
+      version 5.  In this way the global interface version is used as a
+      sort of "counter" for all of its child interfaces.  This makes it
+      very simple to know the version of the child given the version of its
+      parent.  The child is at the highest possible interface version that
+      is less than or equal to its parent's version.
+    </para>
+    <para>
+      It is worth noting a particular exception to the above versioning
+      scheme.  The wl_display (and, by extension, wl_registry) interface
+      cannot change because it is the core protocol object and its version
+      is never advertised nor is there a mechanism to request a different
+      version.
+    </para>
+  </section>
   <section id="sect-Protocol-Connect-Time">
     <title>Connect Time</title>
     <para>

commit b6c49c9e2526010233160462a085e477b321787f
Author: Jason Ekstrand <jason@jlekstrand.net>
Date:   Sun Aug 18 16:52:36 2013 -0500

    doc: Update the ID alocation section
    
    The method described of alocation IDs has been wrong at least since version
    1.0.  This commit updates it to correspond to the way IDs are chosen in
    versions >= 1.0.
    
    Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>

diff --git a/doc/publican/sources/Protocol.xml b/doc/publican/sources/Protocol.xml
index 33df6a9..74f2aea 100644
--- a/doc/publican/sources/Protocol.xml
+++ b/doc/publican/sources/Protocol.xml
@@ -196,10 +196,16 @@
   <section id="sect-Protocol-Creating-Objects">
     <title>Creating Objects</title>
     <para>
-      Each object has a unique ID. The IDs are allocated by the
-      client, from a range of IDs. The server tracks how many
-      IDs are left in the current range and sends a new range
-      when the client is about to run out.
+      Each object has a unique ID.  The IDs are allocated by the entity
+      creating the object (either client or server).  IDs allocated by the
+      client are in the range [1, 0xfeffffff] while IDs allocated by the
+      server are in the range [0xff000000, 0xffffffff].  The 0 ID is
+      reserved to represent a null or non-existant object.
+
+      For efficiency purposes, the IDs are densely packed in the sense that
+      the ID N will not be used until N-1 has been used.  Any ID allocation
+      algorithm that does not maintain this property is incompatible with
+      the implementation in libwayland.
     </para>
   </section>
   <section id="sect-Protocol-Compositor">

commit d1fb2f60b83a6f9451461fa52b0eaaa611004ca4
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Aug 15 20:58:10 2013 +1000

    publican: only split chapters and top-level sections onto separate pages
    
    When generating HTML, don't split once we're into subjections. This
    generates a single page for each protocol interface instead of the previous
    separate pages for requests, events and enums.
    No effect on the rest of the HTML configuration.

diff --git a/doc/publican/publican.cfg b/doc/publican/publican.cfg
index d950584..0bc8a7e 100644
--- a/doc/publican/publican.cfg
+++ b/doc/publican/publican.cfg
@@ -6,3 +6,4 @@ type: Book
 brand: common
 tmp_dir: Wayland
 toc_section_depth: 1
+chunk_section_depth: 1

commit 1f5698b173ce643910e75518fd32ff2d91239c79
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 17:44:59 2013 +0000

    protocol: Improve a bit of grammar for wl_surface::attach description
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index ce0bfa0..643995d 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -952,10 +952,10 @@
 
 	Destroying the wl_buffer after wl_buffer.release does not change
 	the surface contents. However, if the client destroys the
-	wl_buffer before receiving wl_buffer.release, the surface
+	wl_buffer before receiving the wl_buffer.release event, the surface
 	contents become undefined immediately.
 
-	Only if wl_surface.attach is sent with a NULL wl_buffer, the
+	If wl_surface.attach is sent with a NULL wl_buffer, the
 	following wl_surface.commit will remove the surface content.
       </description>
 

commit 2830aa14c9e0683709adbc4cb39749917be05b17
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:07 2013 +0000

    protocol: Fix pluralization of user in popup_done description
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 7ad0ddb..ce0bfa0 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -890,7 +890,7 @@
     <event name="popup_done">
       <description summary="popup interaction is done">
 	The popup_done event is sent out when a popup grab is broken,
-	that is, when the users clicks a surface that doesn't belong
+	that is, when the user clicks a surface that doesn't belong
 	to the client owning the popup surface.
       </description>
     </event>

commit 69d9c21973a825c3f520e7d53a59127f552f8c00
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:07 2013 +0000

    protocol: Improve grammar for set class description
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 0dbe988..7ad0ddb 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -846,9 +846,9 @@
 	Set a class for the surface.
 
 	The surface class identifies the general class of applications
-	to which the surface belongs. A common convention is to use
-	the file name (full path if non-standard location) of the
-	applications .desktop file as the class.
+	to which the surface belongs. A common convention is to use the
+	file name (or the full path if it is a non-standard location) of
+	the application's .desktop file as the class.
       </description>
       <arg name="class_" type="string"/>
     </request>

commit 4ed12d470f99663e596ab8d4e952fdf8383d07f2
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:07 2013 +0000

    protocol: Add missing d to 'x an y'
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 5b50223..0dbe988 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -521,7 +521,7 @@
       <description summary="initiate drag-and-drop session">
 	This event is sent when an active drag-and-drop pointer enters
 	a surface owned by the client.  The position of the pointer at
-	enter time is provided by the x an y arguments, in surface
+	enter time is provided by the x and y arguments, in surface
 	local coordinates.
       </description>
 
@@ -544,7 +544,7 @@
       <description summary="drag-and-drop session motion">
 	This event is sent when the drag-and-drop pointer moves within
 	the currently focused surface. The new position of the pointer
-	is provided by the x an y arguments, in surface local
+	is provided by the x and y arguments, in surface local
 	coordinates.
       </description>
       <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>

commit 84c554bbc4aa75842a61f30a996a1b9686117bbb
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:07 2013 +0000

    protocol: Fix typo by removing a redundant 'a'
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 1442b6a..5b50223 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -577,7 +577,7 @@
 
   <interface name="wl_data_device_manager" version="1">
     <description summary="data transfer interface">
-      The wl_data_device_manager is a a singleton global object that
+      The wl_data_device_manager is a singleton global object that
       provides access to inter-client data transfer mechanisms such as
       copy-and-paste and drag-and-drop.  These mechanisms are tied to
       a wl_seat and this interface lets a client get a wl_data_device

commit fbb947878791ccf67e214cfa714268b9db0c54a4
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:06 2013 +0000

    client: Improve spelling and grammar in comments
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 532d379..b5d9030 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -563,7 +563,7 @@ wl_display_connect_to_fd(int fd)
  * \return A \ref wl_display object or \c NULL on failure
  *
  * Connect to the Wayland display named \c name. If \c name is \c NULL,
- * its value will bee replaced with the WAYLAND_DISPLAY environment
+ * its value will be replaced with the WAYLAND_DISPLAY environment
  * variable if it is set, otherwise display "wayland-0" will be used.
  *
  * \memberof wl_display
@@ -1148,7 +1148,7 @@ wl_display_dispatch_queue(struct wl_display *display,
  *
  * Dispatch all incoming events for objects assigned to the given
  * event queue. On failure -1 is returned and errno set appropriately.
- * If there are no events queued, this functions return immediately.
+ * If there are no events queued, this function returns immediately.
  *
  * \memberof wl_display
  * \since 1.0.2
@@ -1241,12 +1241,12 @@ wl_display_dispatch_pending(struct wl_display *display)
 	return wl_display_dispatch_queue_pending(display, &display->queue);
 }
 
-/** Retrieve the last error occurred on a display
+/** Retrieve the last error that occurred on a display
  *
  * \param display The display context object
- * \return The last error occurred on \c display or 0 if no error occurred
+ * \return The last error that occurred on \c display or 0 if no error occurred
  *
- * Return the last error occurred on the display. This may be an error sent
+ * Return the last error that occurred on the display. This may be an error sent
  * by the server or caused by the local client.
  *
  * \note Errors are \b fatal. If this function returns non-zero the display
@@ -1271,7 +1271,7 @@ wl_display_get_error(struct wl_display *display)
 /** Send all buffered requests on the display to the server
  *
  * \param display The display context object
- * \return The number of bytes send on success or -1 on failure
+ * \return The number of bytes sent on success or -1 on failure
  *
  * Send all buffered data on the client side to the server. Clients
  * should call this function before blocking. On success, the number

commit 8c3aa0bd4fe5786838217384345e38bd3ce01f0c
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:05 2013 +0000

    publican: Fix grammar several places in Protocol docs
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/doc/publican/sources/Protocol.xml b/doc/publican/sources/Protocol.xml
index 1a7a7da..33df6a9 100644
--- a/doc/publican/sources/Protocol.xml
+++ b/doc/publican/sources/Protocol.xml
@@ -285,11 +285,11 @@
       A surface can change the pointer image when the surface is the pointer
       focus of the input device.  Wayland doesn't automatically change the
       pointer image when a pointer enters a surface, but expects the
-      application to set the cursor it wants in response the pointer
+      application to set the cursor it wants in response to the pointer
       focus and motion events.  The rationale is that a client has to manage
       changing pointer images for UI elements within the surface in response
       to motion events anyway, so we'll make that the only mechanism for
-      setting changing the pointer image.  If the server receives a request
+      setting or changing the pointer image.  If the server receives a request
       to set the pointer image after the surface loses pointer focus, the
       request is ignored.  To the client this will look like it successfully
       set the pointer image.
@@ -312,8 +312,8 @@
   <section id="sect-Protocol-Output">
     <title>Output</title>
     <para>
-      A output is a global object, advertised at connect time or as they
-      come and go.
+      An output is a global object, advertised at connect time or as it
+      comes and goes.
     </para>
     <para>
       See <xref linkend="protocol-spec-interface-wl_output"/> for the protocol
@@ -452,7 +452,7 @@
 	</para>
 	<para>
 	  When the drag ends, the receiving client receives a
-	  <function>wl_data_device.drop</function> event at which it is expect
+	  <function>wl_data_device.drop</function> event at which it is expected
 	  to transfer the data using the
 	  <function>wl_data_offer.receive</function> request.
 	</para>

commit 820b0966cb26c086cf83925cf32ee28b990610e0
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:05 2013 +0000

    publican: Drop unneeded 'of'
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/doc/publican/sources/Introduction.xml b/doc/publican/sources/Introduction.xml
index b3b89e7..7516c33 100644
--- a/doc/publican/sources/Introduction.xml
+++ b/doc/publican/sources/Introduction.xml
@@ -8,7 +8,7 @@
   <section id="sect-Motivation">
     <title>Motivation</title>
     <para>
-      Most of Linux and Unix-based systems rely on the X Window System (or
+      Most Linux and Unix-based systems rely on the X Window System (or
       simply <emphasis>X</emphasis>) as the low-level protocol for building
       bitmap graphics interfaces. On these systems, the X stack has grown to
       encompass functionality arguably belonging in client libraries,

commit 467d95ab73000367ee1c2c18bbdd13fe0165aeab
Author: Bryce W. Harrington <b.harrington@samsung.com>
Date:   Fri Aug 9 01:47:04 2013 +0000

    publican: Cleanup Preface's grammar.
    
    Signed-off-by: Bryce Harrington <b.harrington@samsung.com>

diff --git a/doc/publican/sources/Foreword.xml b/doc/publican/sources/Foreword.xml
index eeb16cc..e6875a3 100644
--- a/doc/publican/sources/Foreword.xml
+++ b/doc/publican/sources/Foreword.xml
@@ -9,15 +9,14 @@
   <title>Preface</title>
 
   <para>
-  This document concerns the (i) Wayland architecture, (ii) Wayland model of
-  operation and (iii) its library API. Wayland protocol specification is shown
-  also in the Appendix. The document here is aimed at Wayland developers and
-  who is looking for information how to program with it, but it is not meant
-  primarily for applications developers.
+  This document describes the (i) Wayland architecture, (ii) Wayland model of
+  operation and (iii) its library API. Also, the Wayland protocol specification is shown
+  in the Appendix. This document is aimed primarily at Wayland developers and
+  those looking to program with it; it does not cover application development.
   </para>
   <para>
-  There have been many contributors to this document and, while this is the
-  first edition only, many errors are expected to be found. We appreciate
+  There have been many contributors to this document and since this is only the
+  first edition many errors are expected to be found. We appreciate
   corrections.
   </para>
   <literallayout>

commit 217af6c71cb3f285fa47d1f4d45e2057bf92b523
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Aug 7 11:05:59 2013 +1000

    scanner: check for wayland-scanner.pc before using variables
    
    If wayland-scanner.pc can't be found the variables end up being set
    irrespectively, leaving the user with odd compiler errors about missing
    headers, etc.

diff --git a/wayland-scanner.m4 b/wayland-scanner.m4
index 2b87c5f..4e4222a 100644
--- a/wayland-scanner.m4
+++ b/wayland-scanner.m4
@@ -1,6 +1,8 @@
 AC_DEFUN([WAYLAND_SCANNER_RULES], [
     PKG_PROG_PKG_CONFIG
 
+    PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner])
+
     wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
     AC_SUBST([wayland_scanner])
 

commit f997ed2f4757a0abe2d3a7844e9c9d4e807e0f75
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Aug 7 11:05:58 2013 +1000

    scanner: expand help string
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/scanner.c b/src/scanner.c
index ace6633..5124000 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -34,6 +34,10 @@ static int
 usage(int ret)
 {
 	fprintf(stderr, "usage: ./scanner [client-header|server-header|code]\n");
+	fprintf(stderr, "\n");
+	fprintf(stderr, "Converts XML protocol descriptions supplied on "
+			"stdin to client headers,\n"
+			"server headers, or protocol marshalling code.\n");
 	exit(ret);
 }
 

commit a4ac7a67867013cc2848e044f0220fe631946066
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Aug 7 11:05:57 2013 +1000

    scanner: support help and --help
    
    wayland-scanner without arguments prints out usage. With help or --help it
    waits for stdin to supply something which isn't quite as informative as
    printing out the help.
    
    This patch also moves the strcmp for args up to have all of them in one
    location.

diff --git a/src/scanner.c b/src/scanner.c
index 4aa70d1..ace6633 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1158,9 +1158,22 @@ int main(int argc, char *argv[])
 	struct protocol protocol;
 	int len;
 	void *buf;
+	enum {
+		CLIENT_HEADER,
+		SERVER_HEADER,
+		CODE,
+	} mode;
 
 	if (argc != 2)
 		usage(EXIT_FAILURE);
+	else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "--help") == 0)
+		usage(EXIT_SUCCESS);
+	else if (strcmp(argv[1], "client-header") == 0)
+		mode = CLIENT_HEADER;
+	else if (strcmp(argv[1], "server-header") == 0)
+		mode = SERVER_HEADER;
+	else if (strcmp(argv[1], "code") == 0)
+		mode = CODE;
 
 	wl_list_init(&protocol.interface_list);
 	protocol.type_index = 0;
@@ -1193,12 +1206,16 @@ int main(int argc, char *argv[])
 
 	XML_ParserFree(ctx.parser);
 
-	if (strcmp(argv[1], "client-header") == 0) {
-		emit_header(&protocol, 0);
-	} else if (strcmp(argv[1], "server-header") == 0) {
-		emit_header(&protocol, 1);
-	} else if (strcmp(argv[1], "code") == 0) {
-		emit_code(&protocol);
+	switch(mode) {
+		case CLIENT_HEADER:
+			emit_header(&protocol, 0);
+			break;
+		case SERVER_HEADER:
+			emit_header(&protocol, 1);
+			break;
+		case CODE:
+			emit_code(&protocol);
+			break;
 	}
 
 	return 0;

commit 7db9d248ce78cdf790a14589036b1cfc88c77663
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Tue Aug 6 10:15:35 2013 -0700

    server: Set client->error when we fail to send a closure
    
    We we're using wl_event_loop_add_idle() here, but if we're failing
    because of OOM, that will typically also fail.  Instead, use the
    existing client->error flag, which will break out of the event
    handling loop and shut down the client.

diff --git a/src/wayland-server.c b/src/wayland-server.c
index b74f87a..824f9d1 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -116,14 +116,6 @@ struct wl_resource {
 
 static int wl_debug = 0;
 
-static void
-destroy_client(void *data)
-{
-	struct wl_client *client = data;
-
-	wl_client_destroy(client);
-}
-
 WL_EXPORT void
 wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
 {
@@ -137,13 +129,12 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
 	va_end(ap);
 
 	if (closure == NULL) {
-		resource->client->error = 1
+		resource->client->error = 1;
 		return;
 	}
 
 	if (wl_closure_send(closure, resource->client->connection))
-		wl_event_loop_add_idle(resource->client->display->loop,
-				       destroy_client, resource->client);
+		resource->client->error = 1;
 
 	if (wl_debug)
 		wl_closure_print(closure, object, true);
@@ -165,13 +156,12 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
 	va_end(ap);
 
 	if (closure == NULL) {
-		resource->client->error = 1
+		resource->client->error = 1;
 		return;
 	}
 
 	if (wl_closure_queue(closure, resource->client->connection))
-		wl_event_loop_add_idle(resource->client->display->loop,
-				       destroy_client, resource->client);
+		resource->client->error = 1;
 
 	if (wl_debug)
 		wl_closure_print(closure, object, true);

commit c0eb45286c636efcefc897894c95a284a53216d3
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Tue Aug 6 09:50:14 2013 -0700

    server: Handle OOM properly when we fail to allocate a send closure
    
    If we can't allocate a closure, don't just silently continue.  Set
    client->error so we shut down the client when we're done processing events.

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 0a6e112..b74f87a 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -136,8 +136,10 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
 				      &object->interface->events[opcode]);
 	va_end(ap);
 
-	if (closure == NULL)
+	if (closure == NULL) {
+		resource->client->error = 1
 		return;
+	}
 
 	if (wl_closure_send(closure, resource->client->connection))
 		wl_event_loop_add_idle(resource->client->display->loop,
@@ -162,8 +164,10 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
 				      &object->interface->events[opcode]);
 	va_end(ap);
 
-	if (closure == NULL)
+	if (closure == NULL) {
+		resource->client->error = 1
 		return;
+	}
 
 	if (wl_closure_queue(closure, resource->client->connection))
 		wl_event_loop_add_idle(resource->client->display->loop,

commit d2aac9dca9e3ee7f9071c667ff67ed7849e93835
Author: Jiergir Ogoerg <f35f22fan@gmail.com>
Date:   Mon Jul 29 16:50:44 2013 -0700

    client: Simply wl_display_dispatch_queue_pending() and fix return value
    
    We're supposed to return number of events dispatched on success, not 0.
    Refactor to avoid goto and just return ret.

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 2887a40..532d379 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1157,18 +1157,15 @@ WL_EXPORT int
 wl_display_dispatch_queue_pending(struct wl_display *display,
 				  struct wl_event_queue *queue)
 {
+	int ret;
+
 	pthread_mutex_lock(&display->mutex);
 
-	if (dispatch_queue(display, queue) == -1)
-		goto err_unlock;
+	ret = dispatch_queue(display, queue);
 
 	pthread_mutex_unlock(&display->mutex);
 
-	return 0;
-
- err_unlock:
-	pthread_mutex_unlock(&display->mutex);
-	return -1;
+	return ret;
 }
 
 /** Process incoming events


Reply to: