]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dcclient.cpp
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[wxWidgets.git] / src / osx / carbon / dcclient.cpp
index 663640741cd7e5b2c27f969977f85ff032f9954e..21f3c245bdfc8dd9d543e1e411830f2b011b8e02 100644 (file)
@@ -68,7 +68,9 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
         if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 )
             CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() );
 
-        SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );
+        wxGraphicsContext* context = wxGraphicsContext::CreateFromNative( cg );
+        context->EnableOffset(true);
+        SetGraphicsContext( context );
     }
     DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
 
@@ -161,6 +163,8 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
 
 wxClientDCImpl::~wxClientDCImpl()
 {
+    if( GetGraphicsContext() && GetGraphicsContext()->GetNativeContext() )
+        Flush();
 }
 
 /*