X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d156af3247c862e51a7c62f569a3fd302052a42..08670ea85abf4b4946a9ce64971b591d7b1ee30b:/src/osx/carbon/region.cpp diff --git a/src/osx/carbon/region.cpp b/src/osx/carbon/region.cpp index 6f703117da..83a2e15e12 100644 --- a/src/osx/carbon/region.cpp +++ b/src/osx/carbon/region.cpp @@ -68,14 +68,6 @@ public: // wxRegion //----------------------------------------------------------------------------- -/*! - * Create an empty region. - */ -wxRegion::wxRegion() -{ - m_refData = new wxRegionRefData(); -} - wxRegion::wxRegion(WXHRGN hRegion ) { wxCFRef< HIShapeRef > shape( (HIShapeRef) hRegion ); @@ -186,7 +178,7 @@ void wxRegion::Clear() // Move the region bool wxRegion::DoOffset(wxCoord x, wxCoord y) { - wxCHECK_MSG( M_REGION, false, wxT("invalid wxRegion") ); + wxCHECK_MSG( m_refData, false, wxT("invalid wxRegion") ); if ( !x && !y ) // nothing to do @@ -205,6 +197,30 @@ bool wxRegion::DoCombine(const wxRegion& region, wxRegionOp op) { wxCHECK_MSG( region.IsOk(), false, wxT("invalid wxRegion") ); + // Handle the special case of not initialized (e.g. default constructed) + // region as we can't use HIShape functions if we don't have any shape. + if ( !m_refData ) + { + switch ( op ) + { + case wxRGN_COPY: + case wxRGN_OR: + case wxRGN_XOR: + // These operations make sense with a null region. + *this = region; + return true; + + case wxRGN_AND: + case wxRGN_DIFF: + // Those ones don't really make sense so just leave this region + // empty/invalid. + return false; + } + + wxFAIL_MSG( wxT("Unknown region operation") ); + return false; + } + AllocExclusive(); switch (op)