linebender/druid · error

unable to acquire underlying compositor to acquire shared…

Error message

unable to acquire underlying compositor to acquire shared memory

What it means

Generic guard panic in Compositor for CompositorHandle::shared_mem: the Weak<dyn Compositor> held by the handle has been dropped, so the wl_shm global cannot be reached to allocate shared memory for buffers. It fires when buffer allocation (e.g. during paint) happens after the compositor backend has been dropped, and is called from Data-driven buffer creation paths.

Solutions

  1. Ensure the compositor object outlives all shared-memory allocations by keeping a strong reference where buffers are created
  2. Check Weak::upgrade before allocating and abort the paint path gracefully if the compositor is gone
  3. Tie CompositorHandle's lifetime to the window so it is never used post-teardown
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at druid-shell/src/backend/wayland/surfaces/mod.rs:151 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of linebender/druid@0f8b1195e4 (2026-09-10). Data as JSON: /api/errors/3df7dbb2e3c90bd1. Report an issue: GitHub.

Appendix: source

Thrown at druid-shell/src/backend/wayland/surfaces/mod.rs:151

    }

    fn create_surface(&self) -> wlc::Main<WlSurface> {
        match self.inner.upgrade() {
            None => panic!("unable to acquire underlying compositor to create a surface"),
            Some(c) => c.create_surface(),
        }
    }

    fn create_region(&self) -> wlc::Main<WlRegion> {
        match self.inner.upgrade() {
            None => panic!("unable to acquire underlying compositor to create a region"),
            Some(c) => c.create_region(),
        }
    }

    fn shared_mem(&self) -> wlc::Main<WlShm> {
        match self.inner.upgrade() {
            None => panic!("unable to acquire underlying compositor to acquire shared memory"),
            Some(c) => c.shared_mem(),
        }
    }

    fn get_xdg_positioner(&self) -> wlc::Main<xdg_positioner::XdgPositioner> {
        match self.inner.upgrade() {
            None => panic!("unable to acquire underlying compositor to create an xdg positioner"),
            Some(c) => c.get_xdg_positioner(),
        }
    }

    fn get_xdg_surface(&self, s: &wlc::Main<WlSurface>) -> wlc::Main<xdg_surface::XdgSurface> {
        match self.inner.upgrade() {
            None => panic!("unable to acquire underlying compositor to create an xdg surface"),
            Some(c) => c.get_xdg_surface(s),
        }
    }

View on GitHub (pinned to 0f8b1195e4)