AndroidStyle: use std::make_shared()

More efficient, because control block and tracked object
are co-located in a single memory allocation.

Change-Id: Id18e2d06db43568eb34c2e2d129d1b116af73acb
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2015-11-29 21:08:26 +01:00
parent f2fbee5134
commit 14d189f787

View File

@ -218,7 +218,7 @@ QJsonObject AndroidStyle::loadStyleData()
static std::shared_ptr<AndroidStyle> loadAndroidStyle(QPalette *defaultPalette)
{
double pixelDensity = qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") ? QtAndroid::pixelDensity() : 1.0;
std::shared_ptr<AndroidStyle> style(new AndroidStyle);
std::shared_ptr<AndroidStyle> style = std::make_shared<AndroidStyle>();
style->m_styleData = AndroidStyle::loadStyleData();
if (style->m_styleData.isEmpty())
return std::shared_ptr<AndroidStyle>();