#ifdef __WXGTK20__
const wxDCImpl *impl = dc.GetImpl();
- Init( (cairo_t*) impl->GetCairoContext() );
+ cairo_t* cr = static_cast<cairo_t*>(impl->GetCairoContext());
+ if (cr)
+ Init(cairo_reference(cr));
#endif
wxSize sz = dc.GetSize();
m_width = sz.x;
#ifdef __WXGTK3__
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
if (cr)
- Init(cr);
+ Init(cairo_reference(cr));
#elif defined __WXGTK20__
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
#ifdef __WXGTK3__
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
if (cr)
- Init(cr);
+ Init(cairo_reference(cr));
#elif defined __WXGTK20__
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );