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
- Build a VST3 plugin using VSTGUI on Linux
- Load in REAPER (Linux, Flatpak version tested)
- Open the plugin UI
- Close and reopen the plugin UI multiple times
- Crash occurs on the 2nd-4th reopen
Environment
- REAPER 7.65 (Flatpak)
- Linux (Fedora)
- VSTGUI commit:
d473fc80 (origin/develop)
Related
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 thecairo_device_finish()call fromCairoGraphicsDevice::~CairoGraphicsDevice(). This causes a crash on Linux when repeatedly opening/closing a plugin UI in REAPER.Crash
Root Cause
The commit
5dc86672removed this code that was added in PR #337: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()beforecairo_device_destroy()fixes the crash.Reproduction
Environment
d473fc80(origin/develop)Related