qoperatingsystemversion_win: cache the retrieved version
Make it a static variable to avoid acquiring the system version multiple times. The system version won't change at runtime after all. Pick-to: 6.2 Change-Id: Ic381e5dd7b482fedc9c01242482559ffca9d3f2b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
059c48b908
commit
3fe89eec61
@ -110,12 +110,14 @@ OSVERSIONINFOEX qWindowsVersionInfo()
|
||||
|
||||
QOperatingSystemVersion QOperatingSystemVersion::current()
|
||||
{
|
||||
QOperatingSystemVersion v;
|
||||
v.m_os = currentType();
|
||||
const OSVERSIONINFOEX osv = qWindowsVersionInfo();
|
||||
v.m_major = osv.dwMajorVersion;
|
||||
v.m_minor = osv.dwMinorVersion;
|
||||
v.m_micro = osv.dwBuildNumber;
|
||||
static QOperatingSystemVersion v;
|
||||
if (v.m_os == Unknown) {
|
||||
v.m_os = currentType();
|
||||
const OSVERSIONINFOEX osv = qWindowsVersionInfo();
|
||||
v.m_major = osv.dwMajorVersion;
|
||||
v.m_minor = osv.dwMinorVersion;
|
||||
v.m_micro = osv.dwBuildNumber;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user