Skip to content

[Linux] Regression: Crash on REAPER when reopening plugin UI (cairo-xcb assertion) #377

@yonie

Description

@yonie

Description

A regression was introduced in commit 5dc86672 ("cairo_device_finish is automatically called by cairo_device_destroy when the ref count reaches zero") which removed the cairo_device_finish() call from CairoGraphicsDevice::~CairoGraphicsDevice(). This causes a crash on Linux when repeatedly opening/closing a plugin UI in REAPER.

Crash

reaper: ../src/cairo-xcb-screen.c:219: _get_screen_index: Assertion `!"reached"' failed.

Root Cause

The commit 5dc86672 removed this code that was added in PR #337:

// In CairoGraphicsDevice::~CairoGraphicsDevice()
if (impl->device)
{
    cairo_device_finish (impl->device);  // This line was removed
    cairo_device_destroy (impl->device);
}

The commit message claims "cairo_device_finish is automatically called by cairo_device_destroy when the ref count reaches zero", but this doesn't account for the XCB connection lifecycle when the host (REAPER) repeatedly opens/closes the plugin editor.

Workaround

Re-adding cairo_device_finish() before cairo_device_destroy() fixes the crash.

Reproduction

  1. Build a VST3 plugin using VSTGUI on Linux
  2. Load in REAPER (Linux, Flatpak version tested)
  3. Open the plugin UI
  4. Close and reopen the plugin UI multiple times
  5. Crash occurs on the 2nd-4th reopen

Environment

  • REAPER 7.65 (Flatpak)
  • Linux (Fedora)
  • VSTGUI commit: d473fc80 (origin/develop)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions