diff options
author | Laurent Montel <montel@kde.org> | 2019-10-30 13:37:44 +0100 |
---|---|---|
committer | Laurent Montel <montel@kde.org> | 2019-10-30 13:37:44 +0100 |
commit | 80bf4c029e4cce085497f018193f0b7551f9e744 (patch) | |
tree | db46679899b26b0c9b43cd1b3a2beb056ea8fdeb /src/core/kconfig.cpp | |
parent | d704d7a465417e4ced8354f89cd5ee74a351c9bc (diff) | |
download | kconfig-80bf4c029e4cce085497f018193f0b7551f9e744.tar.gz kconfig-80bf4c029e4cce085497f018193f0b7551f9e744.tar.bz2 |
Make it compile against qt5.15 without deprecated method
Diffstat (limited to 'src/core/kconfig.cpp')
-rw-r--r-- | src/core/kconfig.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 6d6a1ac6..70652365 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -70,11 +70,17 @@ KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags, configState(KConfigBase::NoAccess) { static QBasicAtomicInt use_etc_kderc = Q_BASIC_ATOMIC_INITIALIZER(-1); +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) if (use_etc_kderc.load() < 0) { use_etc_kderc.store( !qEnvironmentVariableIsSet("KDE_SKIP_KDERC")); // for unit tests } if (use_etc_kderc.load()) { - +#else + if (use_etc_kderc.loadRelaxed() < 0) { + use_etc_kderc.storeRelaxed( !qEnvironmentVariableIsSet("KDE_SKIP_KDERC")); // for unit tests + } + if (use_etc_kderc.loadRelaxed()) { +#endif etc_kderc = #ifdef Q_OS_WIN QFile::decodeName(qgetenv("WINDIR") + "/kde5rc"); @@ -82,7 +88,11 @@ KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags, QStringLiteral("/etc/kde5rc"); #endif if (!QFileInfo(etc_kderc).isReadable()) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) use_etc_kderc.store(false); +#else + use_etc_kderc.storeRelaxed(false); +#endif etc_kderc.clear(); } } @@ -256,7 +266,11 @@ KConfig::KConfig(KConfigPrivate &d) KConfig::~KConfig() { Q_D(KConfig); +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) if (d->bDirty && (d->mBackend && d->mBackend->ref.load() == 1)) { +#else + if (d->bDirty && (d->mBackend && d->mBackend->ref.loadRelaxed() == 1)) { +#endif sync(); } delete d; |