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 <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
b1db1dd655
commit
96ff6e8ebe
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user