linebender/druid · error

unable to acquire underlying compositor to create a surface

Error message

unable to acquire underlying compositor to create a surface

What it means

Guard panic in Compositor for CompositorHandle::create_surface: the interior Weak<dyn Compositor> no longer upgrades, meaning the underlying compositor object was dropped. Called when a new wl_surface must be created for a window; fires only if the window is being used after its compositor backend was torn down.

Solutions

  1. Do not retain or use the window/handle after the compositor backend has been dropped
  2. Upgrade the Weak reference before surface creation and fail gracefully if it is gone
  3. Verify window lifetime management so WaylandWindow's compositor outlives all surface creation requests
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at druid-shell/src/backend/wayland/surfaces/mod.rs:137 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/5f3b33e265791d9b. Report an issue: GitHub.

Appendix: source

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

                tracing::warn!("wayland never reported which output we are drawing to");
                1
            }
            scale => scale,
        }
    }
}

impl Compositor for CompositorHandle {
    fn output(&self, id: u32) -> Option<outputs::Meta> {
        match self.inner.upgrade() {
            None => None,
            Some(c) => c.output(id),
        }
    }

    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(),
        }
    }

View on GitHub (pinned to 0f8b1195e4)