Corrected test for region validity in wxMSW wxRegion::DoOffset().
Checking M_REGION is not enough as the region can be invalid (meaning m_refData dereferenced inside M_REGION is NULL itself) and not just not initialized, so it resulted in crashes and not just the expected assert failure when wxRegion::Offset() was called for an invalid region. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
03dc350fa6
commit
5b130f274e
@ -165,7 +165,8 @@ void wxRegion::Clear()
|
||||
|
||||
bool wxRegion::DoOffset(wxCoord x, wxCoord y)
|
||||
{
|
||||
wxCHECK_MSG( M_REGION, false, wxT("invalid wxRegion") );
|
||||
const HRGN hrgn = GetHrgn();
|
||||
wxCHECK_MSG( hrgn, false, wxT("invalid wxRegion") );
|
||||
|
||||
if ( !x && !y )
|
||||
{
|
||||
@ -175,7 +176,7 @@ bool wxRegion::DoOffset(wxCoord x, wxCoord y)
|
||||
|
||||
AllocExclusive();
|
||||
|
||||
if ( ::OffsetRgn(GetHrgn(), x, y) == ERROR )
|
||||
if ( ::OffsetRgn(hrgn, x, y) == ERROR )
|
||||
{
|
||||
wxLogLastError(wxT("OffsetRgn"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user