QWindowsFontDataBase: use QSharedPointer::create()

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

Change-Id: Ibd1a37836b96837afd6209a743a05a727dbc9907
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
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 32eeb46f3c
commit 9cbee30661

View File

@ -1041,7 +1041,7 @@ QSharedPointer<QWindowsFontEngineData> sharedFontData()
{ {
FontEngineThreadLocalData *data = fontEngineThreadLocalData(); FontEngineThreadLocalData *data = fontEngineThreadLocalData();
if (!data->hasLocalData()) if (!data->hasLocalData())
data->setLocalData(QSharedPointer<QWindowsFontEngineData>(new QWindowsFontEngineData)); data->setLocalData(QSharedPointer<QWindowsFontEngineData>::create());
return data->localData(); return data->localData();
} }
#else // !QT_NO_THREAD #else // !QT_NO_THREAD
@ -1051,7 +1051,7 @@ QWindowsFontEngineDataPtr sharedFontData()
{ {
QWindowsFontEngineDataPtr *data = fontEngineData(); QWindowsFontEngineDataPtr *data = fontEngineData();
if (data->isNull()) if (data->isNull())
*data = QWindowsFontEngineDataPtr(new QWindowsFontEngineData); *data = QWindowsFontEngineDataPtr::create();
return *data; return *data;
} }
#endif // QT_NO_THREAD #endif // QT_NO_THREAD