Work around assert on wxDatePickerCtrl creation due to a WINE bug
Don't use invalid SYSTEMTIME returned by DateTime_GetRange() under WINE which always returns GDTR_MIN, even if the min value is not actually valid, see https://bugs.winehq.org/show_bug.cgi?id=40301 This avoids an assert which otherwise happened whenever wxDatePickerCtrl was created.
This commit is contained in:
@@ -196,7 +196,11 @@ bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
|
|||||||
DWORD flags = DateTime_GetRange(GetHwnd(), st);
|
DWORD flags = DateTime_GetRange(GetHwnd(), st);
|
||||||
if ( dt1 )
|
if ( dt1 )
|
||||||
{
|
{
|
||||||
if ( flags & GDTR_MIN )
|
// Workaround for https://bugs.winehq.org/show_bug.cgi?id=40301: WINE
|
||||||
|
// returns GDTR_MIN even if there is no lower range bound. Luckily we
|
||||||
|
// can check for it easily as the SYSTEMTIME contains only zeroes in
|
||||||
|
// this case and 0 is invalid value for wMonth field.
|
||||||
|
if ( (flags & GDTR_MIN) && (st[0].wMonth != 0) )
|
||||||
dt1->SetFromMSWSysDate(st[0]);
|
dt1->SetFromMSWSysDate(st[0]);
|
||||||
else
|
else
|
||||||
*dt1 = wxDefaultDateTime;
|
*dt1 = wxDefaultDateTime;
|
||||||
|
Reference in New Issue
Block a user