Fix leak in date and time formatting on macOS
CFDateFormatterCreateStringWithDate() creates a CFStringRef that we need to tidy up once we're done with it, so use the QCFType template to take care of that. Change-Id: Ibc3751426cc4496bce25307918fdb11722cde3b2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
a8a003aba2
commit
3b84187cd1
@ -157,7 +157,8 @@ static QVariant macDateToString(QDate date, bool short_format)
|
||||
= CFDateFormatterCreate(kCFAllocatorDefault,
|
||||
mylocale, style,
|
||||
kCFDateFormatterNoStyle);
|
||||
return QString::fromCFString(CFDateFormatterCreateStringWithDate(0, myFormatter, myDate));
|
||||
QCFType<CFStringRef> text = CFDateFormatterCreateStringWithDate(0, myFormatter, myDate);
|
||||
return QString::fromCFString(text);
|
||||
}
|
||||
|
||||
static QVariant macTimeToString(QTime time, bool short_format)
|
||||
@ -169,7 +170,8 @@ static QVariant macTimeToString(QTime time, bool short_format)
|
||||
mylocale,
|
||||
kCFDateFormatterNoStyle,
|
||||
style);
|
||||
return QString::fromCFString(CFDateFormatterCreateStringWithDate(0, myFormatter, myDate));
|
||||
QCFType<CFStringRef> text = CFDateFormatterCreateStringWithDate(0, myFormatter, myDate);
|
||||
return QString::fromCFString(text);
|
||||
}
|
||||
|
||||
// Mac uses the Unicode CLDR format codes
|
||||
|
Loading…
Reference in New Issue
Block a user