]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/graphicc.cpp
Fix horizontal mouse wheel scrolling in wxGTK.
[wxWidgets.git] / src / generic / graphicc.cpp
index 1cf971d0e6f0dc9bce9be159b82c06f7856ad050..c89d338f51566603672b402d19030d9b450ecdf7 100644 (file)
@@ -1654,7 +1654,9 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC&
 
 #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;
@@ -1700,7 +1702,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC&
 #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() ) );
@@ -1775,7 +1777,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC&
 #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() ) );