Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when repeatedly opening/closing GUI #335

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions vstgui/lib/platform/linux/cairographicscontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ inline cairo_matrix_t convert (const TransformMatrix& ct)
struct CairoGraphicsDeviceFactory::Impl
{
std::vector<std::shared_ptr<CairoGraphicsDevice>> devices;
Impl() = default;
~Impl() noexcept
{
for (auto& device : devices)
{
#if DEBUG
DebugPrint ("Cairo device reference count: %u\n", cairo_device_get_reference_count (device->get ()));
#endif
// Force cairo to remove this device from its internal cache list of devices.
// This is only needed because the reference count never seem to reach 0,
// which means there is still some resource leakage elsewhere in the code.
cairo_device_finish (device->get ());
}
}
};

//-----------------------------------------------------------------------------
Expand Down