You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Buffers are exposed as &mut [MaybeUninit<u8>], see NativeWindowBufferLockGuard::bytes. Is this really necessary, or could we rely on the buffer being zero-initialized? If not, we'll have to do a zeroing step ourselves in buffer_mut.
The surface is both unlocked and presented in NativeWindowBufferLockGuard::drop, whereas Softbuffer allows these two steps to be separate (e.g. you can Drop an in-progress Buffer<'_> and request a new one in Surface::buffer_mut, with no side-effects).
For the last point: I'm curious what happens if lock() is called twice without unlock(); i.e. dropping the buffer while forgetting to present it, if drop() -> unlock() didn't do both automatically. It may seem the Android API doesn't allow this.
That branch surely solves it, but has high Android requirements (most API was added in 29, but a bugfix to use it on the root NativeWindow surface only got accepted in 35). I'll open a PR either way to discuss the details and not forget about it.
Activity
MarijnS95 commentedon Jan 23, 2026
For the last point: I'm curious what happens if
lock()is called twice withoutunlock(); i.e. dropping the buffer while forgetting to present it, ifdrop()->unlock()didn't do both automatically. It may seem the Android API doesn't allow this.That branch surely solves it, but has high Android requirements (most API was added in 29, but a bugfix to use it on the root
NativeWindowsurface only got accepted in 35). I'll open a PR either way to discuss the details and not forget about it.MarijnS95 commentedon Feb 1, 2026
What happens if I
std::mem::forget(buffer)in place ofbuffer.present(), the secondlock()` fails: