fn buffers_recreate(&self) {
        if !self.recreate_buffers.get() {
            return;
        }

        debug_assert!(!self.pending_buffer_borrowed.get());

        // move current buffers into the release queue to be cleaned up later.
        self.buffers_invalidate();

        let new_buffer_size = self.size.get().buffer_size(N.try_into().unwrap());
        // This is probably OOM if it fails, but we unwrap to report the underlying error.
        self.shm.borrow_mut().extend(new_buffer_size).unwrap();

        let pool = self.shm.borrow_mut().create_pool();
        self.buffers.set({
            let mut buffers = vec![];
            let size = self.size.get();
            for i in 0..N {
                buffers.push(Buffer::create(&pool, i, size.width, size.height));
            }
            Some(buffers.try_into().unwrap())
        });
        pool.destroy();
        // Don't unset `recreate_buffers` here. We immediately call paint_unchecked, and need to
        // know if buffers were recreated (to invalidate the whole window).
    }
/// Destroy the current buffers, resize the shared memory pool if necessary, and create new
/// buffers.
Destroy the current buffers, resize the shared memory pool if necessary, and create new
buffers.
Destroy the current buffers resize the shared memory pool if necessary and create new buffers .
fn buffers_recreate(&self) {
        if !self.recreate_buffers.get() {
            return;
        }
        debug_assert!(!self.pending_buffer_borrowed.get());
        // move current buffers into the release queue to be cleaned up later.
        self.buffers_invalidate();
        let new_buffer_size = self.size.get().buffer_size(N.try_into().unwrap());
        // This is probably OOM if it fails, but we unwrap to report the underlying error.
        self.shm.borrow_mut().extend(new_buffer_size).unwrap();
        let pool = self.shm.borrow_mut().create_pool();
        self.buffers.set({
            let mut buffers = vec![];
            let size = self.size.get();
            for i in 0..N {
                buffers.push(Buffer::create(&pool, i, size.width, size.height));
            }
            Some(buffers.try_into().unwrap())
        });
        pool.destroy();
        // Don't unset `recreate_buffers` here. We immediately call paint_unchecked, and need to
        // know if buffers were recreated (to invalidate the whole window).
    }
fn buffers_recreate ( & self ) { if ! self . recreate_buffers . get ( ) { return ; } debug_assert ! ( self pending_buffer_borrowed get ( ) ) ; // move current buffers into the release queue to be cleaned up later. self . buffers_invalidate ( ) ; let new_buffer_size = self . size . get ( ) . buffer_size ( N . try_into ( ) . unwrap ( ) ) ; // This is probably OOM if it fails, but we unwrap to report the underlying error. self . shm . borrow_mut ( ) . extend ( new_buffer_size ) . unwrap ( ) ; let pool = self . shm . borrow_mut ( ) . create_pool ( ) ; self . buffers . set ( { let mut buffers = vec ! [ ] ; let size = self . size . get ( ) ; for i in 0 .. N { buffers . push ( Buffer :: create ( & pool , i , size . width , size . height ) ) ; } Some ( buffers . try_into ( ) . unwrap ( ) ) } ) ; pool . destroy ( ) ; // Don't unset `recreate_buffers` here. We immediately call paint_unchecked, and need to // know if buffers were recreated (to invalidate the whole window). }
Destroy the current buffers, resize the shared memory pool if necessary, and create new
buffers.
Destroy the current buffers resize the shared memory pool if necessary and create new buffers .
&self
&self