From 64e4759f438bbb39e9f8e86b753762c8b370c416 Mon Sep 17 00:00:00 2001
From: Kevin Ollivier <kevino@theolliviers.com>
Date: Wed, 25 Oct 2006 20:00:48 +0000
Subject: [PATCH] Fix wxBufferedDC so that it adheres to its documented
 behavior (which is in use in wxPython at least) and make a note about the
 layout direction assignment.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/bufferdc.tex | 4 ++++
 include/wx/dcbuffer.h      | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/docs/latex/wx/bufferdc.tex b/docs/latex/wx/bufferdc.tex
index 27e750b524..57665f8e4a 100644
--- a/docs/latex/wx/bufferdc.tex
+++ b/docs/latex/wx/bufferdc.tex
@@ -25,6 +25,10 @@ Please note that GTK+ 2.0 as well as OS X provide double buffering themselves
 +natively. Use \helpref{wxWindow::IsDoubleBuffered}{wxwindowisdoublebuffered} to
 +determine whether you need to use buffering or not.
 
+\wxheading{Localization Support}
+
+If you pass in a valid DC, wxBufferedDC will inherit its layout direction.
+
 \wxheading{Derived from}
 
 \helpref{wxMemoryDC}{wxmemorydc}\\
diff --git a/include/wx/dcbuffer.h b/include/wx/dcbuffer.h
index 5b553769b7..1b12cc6f05 100644
--- a/include/wx/dcbuffer.h
+++ b/include/wx/dcbuffer.h
@@ -122,13 +122,13 @@ private:
     void InitCommon(wxDC *dc, int style)
     {
         wxASSERT_MSG( !m_dc, _T("wxBufferedDC already initialised") );
-        wxCHECK_RET( dc, _T("can't associate NULL DC with wxBufferedDC") );
 
         m_dc = dc;
         m_style = style;
 
         // inherit the same layout direction as the original DC
-        SetLayoutDirection(dc->GetLayoutDirection());
+        if (dc && dc->IsOk())
+            SetLayoutDirection(dc->GetLayoutDirection());
     }
 
     // check that the bitmap is valid and use it
-- 
2.50.0

