Skip to content

Commit

Permalink
Avoid crash when setting application font/font size in options dialog
Browse files Browse the repository at this point in the history
https://bugreports.qt.io/browse/QTBUG-69204 causes a segfault
in Qt >= 5.11 if we change the stylesheet on the fly.

Workaround this by only setting the stylesheet once at startup,
and require a restart if settings change which modify the
stylesheet.

Just a workaround -- the upstream bug is being looked at,
but better to require a restart than crash.
  • Loading branch information
nyalldawson committed Oct 25, 2018
1 parent 4f43282 commit ac44bf2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -2403,6 +2403,14 @@ void QgisApp::createActionGroups()

void QgisApp::setAppStyleSheet( const QString &stylesheet )
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
// avoid crash on stylesheet change -- see https://bugreports.qt.io/browse/QTBUG-69204
static bool sOnce = false;
if ( sOnce )
return;
sOnce = true;
#endif

setStyleSheet( stylesheet );

// cascade styles to any current layout designers
Expand Down

0 comments on commit ac44bf2

Please sign in to comment.