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:
Vadim Zeitlin 2016-03-14 01:09:48 +01:00
parent c7a3785a5c
commit 7907711e82

View File

@ -196,7 +196,11 @@ bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
DWORD flags = DateTime_GetRange(GetHwnd(), st);
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]);
else
*dt1 = wxDefaultDateTime;