iOS: Use separate release pool for qt_ios_version()

QSysInfo::MacintoshVersion is initialized before the main thread's release
pool has been set up, so we have to wrap the UIKit usage in our own pool.

Change-Id: I80e2c068339e0251f38ecf55fcfb764594eb3ad7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
bb10
Tor Arne Vestbø 2013-11-21 16:32:00 +01:00 committed by The Qt Project
parent f441d8e523
commit 03cd5b3563
1 changed files with 5 additions and 0 deletions

View File

@ -61,6 +61,8 @@ QString QCFString::toQString(const NSString *nsstr)
#ifdef Q_OS_IOS
QSysInfo::MacVersion qt_ios_version()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int major = 0, minor = 0;
NSArray *components = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
switch ([components count]) {
@ -75,6 +77,9 @@ QSysInfo::MacVersion qt_ios_version()
default:
Q_UNREACHABLE();
}
[pool release];
return QSysInfo::MacVersion(Q_MV_IOS(major, minor));
}
#endif