From: Hu Feng Date: Wed, 3 Mar 2021 01:26:26 +0000 (+0800) Subject: fix the problem of accessing the null pointer in non-dde X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~47 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=96cbcf9493a4c9cc8879b5a1d1e39df9bb42b979;p=dtkcore.git fix the problem of accessing the null pointer in non-dde --- diff --git a/debian/libdtkcore5.symbols b/debian/libdtkcore5.symbols index f9493ee..c6aa5b5 100644 --- a/debian/libdtkcore5.symbols +++ b/debian/libdtkcore5.symbols @@ -199,6 +199,7 @@ libdtkcore.so.5 libdtkcore5 #MINVER# _ZN3Dtk4Core15DSysInfoPrivate16ensureDeepinInfoEv@Base 5.2.2 _ZN3Dtk4Core15DSysInfoPrivate17ensureReleaseInfoEv@Base 5.2.2 _ZN3Dtk4Core15DSysInfoPrivate18ensureComputerInfoEv@Base 5.2.2 + _ZN3Dtk4Core15DSysInfoPrivate22ensureDistributionInfoEv@Base 5.4.0-1~exp1 _ZN3Dtk4Core15DSysInfoPrivateC1Ev@Base 5.2.2 _ZN3Dtk4Core15DSysInfoPrivateC2Ev@Base 5.2.2 _ZN3Dtk4Core15QSettingBackend11doSetOptionERK7QStringRK8QVariant@Base 5.2.2 diff --git a/debian/patches/0001-fix-access-null-pointer.patch b/debian/patches/0001-fix-access-null-pointer.patch new file mode 100644 index 0000000..a5ed0a0 --- /dev/null +++ b/debian/patches/0001-fix-access-null-pointer.patch @@ -0,0 +1,65 @@ +Description: fix access null pointer + TODO: fix access null pointer +Author: Hu Feng + +Forwarded: not-needed +Reviewed-By: +Last-Update: 2021-03-02 + +--- dtkcore-5.4.0.orig/src/dsysinfo.cpp ++++ dtkcore-5.4.0/src/dsysinfo.cpp +@@ -48,6 +48,7 @@ public: + #ifdef Q_OS_LINUX + void ensureDeepinInfo(); + bool ensureOsVersion(); ++ void ensureDistributionInfo(); + #endif + void ensureReleaseInfo(); + void ensureComputerInfo(); +@@ -97,6 +98,16 @@ DSysInfoPrivate::DSysInfoPrivate() + } + + #ifdef Q_OS_LINUX ++void DSysInfoPrivate::ensureDistributionInfo() ++{ ++ if (distributionInfo) ++ return; ++ ++ const QString distributionInfoFile(DSysInfo::distributionInfoPath()); ++ // Generic DDE distribution info ++ distributionInfo.reset(new DDesktopEntry(distributionInfoFile)); ++} ++ + void DSysInfoPrivate::ensureDeepinInfo() + { + if (static_cast(deepinType) >= 0) +@@ -168,11 +179,6 @@ void DSysInfoPrivate::ensureDeepinInfo() + } else { + deepinType = DSysInfo::UnknownDeepin; + } +- +- const QString distributionInfoFile(DSysInfo::distributionInfoPath()); +- // Generic DDE distribution info +- distributionInfo.reset(new DDesktopEntry(distributionInfoFile)); +- QSettings distributionInfo(distributionInfoFile, QSettings::IniFormat); // TODO: treat as `.desktop` format instead of `.ini` + } + + bool DSysInfoPrivate::ensureOsVersion() +@@ -734,7 +740,7 @@ QString DSysInfo::distributionInfoSectio + QString DSysInfo::distributionOrgName(DSysInfo::OrgType type, const QLocale &locale) + { + #ifdef Q_OS_LINUX +- siGlobal->ensureDeepinInfo(); ++ siGlobal->ensureDistributionInfo(); + #endif + + QString fallback = type == Distribution ? QStringLiteral("Deepin") : QString(); +@@ -757,7 +763,7 @@ QString DSysInfo::deepinDistributorName( + QPair DSysInfo::distributionOrgWebsite(DSysInfo::OrgType type) + { + #ifdef Q_OS_LINUX +- siGlobal->ensureDeepinInfo(); ++ siGlobal->ensureDistributionInfo(); + #endif + + QString fallbackSiteName = type == Distribution ? QStringLiteral("www.deepin.org") : QString(); diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..c6db926 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-fix-access-null-pointer.patch