From c54f34fb7c42c4e4b271ed6086e5790d7a97bf00 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 16 Jun 2014 11:20:32 +1000 Subject: Fix crashes on Ubuntu 12.04 caused by overlay scrolll bar causing the drawing surface to be finished. --- gtk/PlatGTK.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gtk') diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index c1e5566e5..d4572a912 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -527,6 +527,22 @@ void SurfaceImpl::Release() { } bool SurfaceImpl::Initialised() { + if (inited && context) { + if (cairo_status(context) == CAIRO_STATUS_SUCCESS) { + // Even when status is success, the target surface may have been + // finished whch may cause an assertion to fail crashing the application. + // The cairo_surface_has_show_text_glyphs call checks the finished flag + // and when set, sets the status to CAIRO_STATUS_SURFACE_FINISHED + // which leads to warning messages instead of crashes. + // Performing the check in this method as it is called rarely and has no + // other side effects. + cairo_surface_t *psurfContext = cairo_get_target(context); + if (psurfContext) { + cairo_surface_has_show_text_glyphs(psurfContext); + } + } + return cairo_status(context) == CAIRO_STATUS_SUCCESS; + } return inited; } -- cgit v1.2.3