diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-27 09:50:22 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-27 13:07:52 +0000 |
commit | 9d7ae28fcc683c185ee0f90728a21e0371e45e2d (patch) | |
tree | d6412d8c71e952af0a49eb60da1c2aaca7619819 /src/imports/platform/qquickplatformfontdialog.cpp | |
parent | 4960f639e338e36b595667f02e2b5fac51aaa07a (diff) |
Platform dialogs: set the options on construction
Platform dialogs hold a shared pointer to an options structure.
Dialog implementations may access the options in various places
(eg. QGtk3FileDialogHelper::selectFile()) and seem to rely that
the options are not null at this point. Thus, pass the options
pointer right away on construction instead of unnecessarily
delaying to applyOptions(), to avoid potential crashes.
Change-Id: I14b0801eb58a9834867dd302a6610e64adeea0cd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/platform/qquickplatformfontdialog.cpp')
-rw-r--r-- | src/imports/platform/qquickplatformfontdialog.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/imports/platform/qquickplatformfontdialog.cpp b/src/imports/platform/qquickplatformfontdialog.cpp index e0fcc23a..b50be0db 100644 --- a/src/imports/platform/qquickplatformfontdialog.cpp +++ b/src/imports/platform/qquickplatformfontdialog.cpp @@ -107,6 +107,7 @@ QQuickPlatformFontDialog::QQuickPlatformFontDialog(QObject *parent) if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(dialog)) { connect(fontDialog, &QPlatformFontDialogHelper::currentFontChanged, this, &QQuickPlatformFontDialog::currentFontChanged); connect(fontDialog, &QPlatformFontDialogHelper::fontSelected, this, &QQuickPlatformFontDialog::fontSelected); + fontDialog->setOptions(m_options); } setHandle(dialog); } @@ -166,8 +167,6 @@ void QQuickPlatformFontDialog::setOptions(QFontDialogOptions::FontDialogOptions void QQuickPlatformFontDialog::applyOptions() { m_options->setWindowTitle(title()); - if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(handle())) - fontDialog->setOptions(m_options); } QT_END_NAMESPACE |