Undefined behavior

Jasper St. Pierre jstpierre at mecheye.net
Tue Aug 12 13:34:03 PDT 2014


In the xdg-shell thread recently, Pekka had a lot of concerns of the kind
"what happens when the client makes an unexpected or illegal request.
Should it be an error?"

I have an answer for this: Any behavior not defined is undefined behavior.
If it's not explicitly mentioned in the protocol, it's undefined behavior.

Undefined behavior means that anything can happen. The compositor can send
you a fatal error. It can mess up your objects in undetectable ways. The
surface contents you present might now be garbage. Obviously, compositors
should try *very* hard to catch all edge cases and send protocol errors,
but it might be difficult or impractical that we can catch all cases.

As a quick example, we have been discussing "surface roles" in the past
week with xdg_surface. Unfortunately, Weston doesn't properly mark cursor
or DND surfaces as having roles, and there's no easy way to check for it in
the codebase.

>From my reading of the code, it seems what would happen is that the cursor
would disappear as the desktop-shell code changes the surface's position,
and on the next mouse move, the cursor would reappear as a wl_pointer.enter
event is sent out over the new surface.

Obviously, no valid program should ever try to reuse a cursor surface as an
xdg_surface.

Thoughts?

-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140812/6e83c2de/attachment.html>


More information about the wayland-devel mailing list