From b6e5a0a6793ac3f9fb83bfc761bc23e89343a419 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 May 2015 02:51:54 +0200 Subject: [PATCH] Try to avoid crashing in wxGTK wxCairoContext ctor. Don't use an uninitialized pointer in wxCairoContext ctor from wxPrinterDC in wxGTK if retrieving Cairo context of the DC failed, set m_context to NULL in this case (not sure if this is still not going to crash when used in cairo_translate() below though). --- src/generic/graphicc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index bafb4af36e..a19ad92f12 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1680,6 +1680,8 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& cairo_t* cr = static_cast(impl->GetCairoContext()); if (cr) Init(cairo_reference(cr)); + else + m_context = NULL; #endif wxSize sz = dc.GetSize(); m_width = sz.x;