diff --git a/doomsday/sdk/libgui/src/text/font.cpp b/doomsday/sdk/libgui/src/text/font.cpp index ea6e17fb63..e625a49bae 100644 --- a/doomsday/sdk/libgui/src/text/font.cpp +++ b/doomsday/sdk/libgui/src/text/font.cpp @@ -13,7 +13,7 @@ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. You should have received a copy of * the GNU Lesser General Public License along with this program; if not, see: - * http://www.gnu.org/licenses + * http://www.gnu.org/licenses */ #include "de/Font" @@ -34,7 +34,7 @@ namespace de { typedef QtNativeFont PlatformFont; } namespace de { -namespace internal +namespace internal { struct FontParams { @@ -62,14 +62,14 @@ namespace internal static uint qHash(FontParams const ¶ms) { - return ::qHash(params.family) + return ::qHash(params.family) ^ ::qHash(int(100 * params.size)) ^ ::qHash(params.spec.weight) ^ ::qHash(int(params.spec.style)); } } -DENG2_PIMPL(Font) +DENG2_PIMPL(Font), public Lockable { PlatformFont font; QHash fontMods; @@ -138,12 +138,14 @@ DENG2_PIMPL(Font) PlatformFont &getFontMod(internal::FontParams const ¶ms) { + DENG2_GUARD(this); + auto found = fontMods.constFind(params); if (found != fontMods.constEnd()) { return *found.value(); } - + auto *mod = new PlatformFont; mod->setFamily(params.family); mod->setSize(params.size);