GNOME Bugzilla – Bug 738887
"Cannot commit NULL buffer to xdg_surface" error too pervasive
Last modified: 2014-11-07 16:32:30 UTC
Currently this check is implemented in practice as "you must have a buffer right from the first wl_surface.commit". Due to this I'm finding hard/awkward to avoid situations in GTK+ if creating subsurface windows close to toplevel initialization (ie. when the toplevel has not yet a buffer), after the subsurface is positioned (for the first time in this case), a commit() on the parent surface is done if there was none yet. Because it didn't have a chance to draw yet, the buffer is NULL, getting then the error from mutter. I suggest to relax a bit the requisitions during surface initialization, and only issue the error if a surface was ever set first and then unset. This makes it possible to have this kind of initialization commit()s while the buffer itself hasn't been initialized yet.
Created attachment 288974 [details] [review] wayland: Allow for wl_surface_commit()s before buffer existence Right now the "Cannot commit NULL buffer to xdg_surface" error check is too strict, failing just anytime a buffer is not attached. Relax this a bit by allowing NULL buffers during initialization, only as long as there was previously a NULL buffer. If a buffer was set, and then unset, the error will be issued.
I've pushed a fix in the GTK+ side for this, so this invariant is respected when committing parent-relative subsurface state.