wltest: keep old buffers alive across resizes
destroying the previous wl_buffer immediately after attaching its replacement raced the compositor's use of the last committed frame and pulled the rug from under data-pointer access to buffers still on screen -- black frames exactly when buffers turned over. a few KB of shm per resize is an acceptable price for a short-lived test client; resizes are rare.
This commit is contained in:
parent
c10845f2c1
commit
2af45a99c1
1 changed files with 4 additions and 6 deletions
|
|
@ -459,12 +459,10 @@ static struct wl_shm_pool *make_pool(size_t size, int *fd_out) {
|
|||
static void create_buffer(void) {
|
||||
/* Recreate at the current W/H on every configure: a test client that
|
||||
silently re-commits its old-size buffer makes compositor resize and
|
||||
fullscreen handling untestable (the surface would keep painting its
|
||||
original extent no matter what the window state says). */
|
||||
if (buffer) {
|
||||
wl_buffer_destroy(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
fullscreen handling untestable. The previous wl_buffer is left alive
|
||||
(a few KB of shm per resize -- wltest is short-lived): destroying it
|
||||
here would race the compositor's use of the last committed frame and
|
||||
kill our own data-access path for buffers still on screen. */
|
||||
size_t stride = (size_t)W * 4;
|
||||
size_t size = stride * (size_t)H;
|
||||
int fd;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue