[Wayland-bugs] [Bug 763852] gdk/wayland: event source is not multi-thread aware

gtk+ (GNOME Bugzilla) bugzilla at gnome.org
Thu Mar 31 06:05:21 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=763852

Jonas Ådahl <jadahl at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #324334|none                        |needs-work
             status|                            |

--- Comment #9 from Jonas Ådahl <jadahl at gmail.com> ---
Review of attachment 324334:

::: gdk/wayland/gdkeventsource.c
@@ +58,3 @@
+   * wl_display_cancel_read() */
+  if (source->reading)
+    wl_display_cancel_read (display->wl_display);

When will this actually happen? Anyway, if it is needed, we should cancel the
read the first thing in this function, so that we don't leave this function
without later polling the fd.

@@ +60,3 @@
+    wl_display_cancel_read (display->wl_display);
+
+  while (wl_display_prepare_read (display->wl_display) != 0)

I think we can just do if (wl_display_prepare_read (display->wl_display) != 0)
return TRUE; as it means we can already dispatch without polling.

We also need to wl_display_prepare_read() on the potential return FALSE; path
above (the first if statement in this function), so that we always have
prepared for reading when we return FALSE.

@@ +81,1 @@
+  if (source->display->event_pause_count > 0) {

nit: { sholud go on its own line.

@@ +90,3 @@
+    {
+      if (wl_display_read_events (display_wayland->wl_display) < 0)
+        g_error ("Error reading events from display: %s", g_strerror (errno));

I think it might be a good idea to either g_assert (source->reading) or
g_return_if_fail (source->reading) before actually reading here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20160331/8503e675/attachment.html>


More information about the wayland-bugs mailing list