From c47f4361751a13cf729e9f0ea8d9646391732e5d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 16 Aug 2019 11:39:20 +0200 Subject: Avoid double QCache lookup in QOpenGLProgramBinaryCache Change-Id: I4384a15f0b89e1f6d7f59bff1816fc2e6fc6adfe Reviewed-by: Marc Mutz --- src/gui/opengl/qopenglprogrambinarycache.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 40237b9935..c3fb375a20 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -264,10 +264,8 @@ public: bool QOpenGLProgramBinaryCache::load(const QByteArray &cacheKey, uint programId) { QMutexLocker lock(&m_mutex); - if (m_memCache.contains(cacheKey)) { - const MemCacheEntry *e = m_memCache[cacheKey]; + if (const MemCacheEntry *e = m_memCache.object(cacheKey)) return setProgramBinary(programId, e->format, e->blob.constData(), e->blob.size()); - } QByteArray buf; const QString fn = cacheFileName(cacheKey); -- cgit v1.2.3 From 96ff6e8ebe80215a0d35055c7382bb1cf58fc660 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 23 Aug 2019 09:35:20 +0200 Subject: QGuiApplication: drop mutex before emitting fontChanged() Emitting a signal executes an unknowable amount of code. We shouldn't hold a mutex while doing so. E.g., if the signal emission causes another call to QGuiApplication::setFont(), the old code would deadlock, since applicationFontMutex is not recursive. Fix by taking a copy of the application font under mutex protection, then dropping the lock for the emission of the signal. Change-Id: Ib2569b3a08af6ef5f38459a19f74cb0db27b7772 Reviewed-by: Volker Hilsheimer Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5014878bd2..359d182dd9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3284,8 +3284,11 @@ void QGuiApplication::setFont(const QFont &font) *QGuiApplicationPrivate::app_font = font; applicationResourceFlags |= ApplicationFontExplicitlySet; - if (emitChange && qGuiApp) - emit qGuiApp->fontChanged(*QGuiApplicationPrivate::app_font); + if (emitChange && qGuiApp) { + auto font = *QGuiApplicationPrivate::app_font; + locker.unlock(); + emit qGuiApp->fontChanged(font); + } } /*! -- cgit v1.2.3