New upstream version 5.7.9
authorBoyuan Yang <byang@debian.org>
Tue, 11 Feb 2025 00:00:36 +0000 (19:00 -0500)
committerBoyuan Yang <byang@debian.org>
Tue, 11 Feb 2025 00:00:36 +0000 (19:00 -0500)
debian/changelog
src/dconfigfile.cpp
src/dsgapplication.cpp
tests/data/dconf-example.meta.json
tests/ut_dconfigfile.cpp

index 68b83c20e85ccaf83b5e4defa8de8e9e3533f660..3861173c32adb94ee99fece8f45f1b953c43fa77 100644 (file)
@@ -1,3 +1,37 @@
+dtkcore (5.7.9) unstable; urgency=medium
+
+  [ root ]
+  * UNRELEASED
+
+ -- Deepin Packages Builder <packages@deepin.org>  Thu, 23 Jan 2025 09:07:08 +0000
+
+dtkcore (5.7.8) unstable; urgency=medium
+
+  [ root ]
+  * UNRELEASED
+
+ -- Deepin Packages Builder <packages@deepin.org>  Tue, 14 Jan 2025 11:17:31 +0000
+
+dtkcore (5.7.7) unstable; urgency=medium
+
+  [ root ]
+  * UNRELEASED
+
+ -- Deepin Packages Builder <packages@deepin.org>  Thu, 09 Jan 2025 09:28:38 +0000
+
+dtkcore (5.7.6) unstable; urgency=medium
+
+  [ root ]
+  * UNRELEASED
+
+ -- Deepin Packages Builder <packages@deepin.org>  Thu, 02 Jan 2025 05:43:52 +0000
+
+dtkcore (5.7.5) unstable; urgency=medium
+
+  * fix: pidfd leak
+
+ -- Deepin Packages Builder <packages@deepin.org>  Thu, 12 Dec 2024 03:03:54 +0000
+
 dtkcore (5.7.4) unstable; urgency=medium
 
   * fix: hasVtable is incorrect when destructing
index 896248a81d122a998771f143183cc6a5a7ea0223..6a7da03d2eaf2c2fdda01079b99ef07e8d309605 100644 (file)
@@ -1288,12 +1288,22 @@ public:
                     return cache->setValue(key, value, configMeta->serial(key), cache->uid(), appid);
 
                 // convert copy to meta's type, it promises `setValue` don't change meta's type.
+                // canConvert isn't explicit, e.g: QString is also can convert to double.
                 auto copy = value;
                 if (!copy.convert(metaValue.metaType())) {
                     qCWarning(cfLog) << "check type error, meta type is " << metaValue.metaType().name()
                                      << ", and now type is " << value.metaType().name();
                     return false;
                 }
+
+                 // TODO it's a bug of qt, MetaType of 1.0 is qlonglong instead of double in json file.
+                static const QVector<QMetaType> filterConvertType {
+                    QMetaType{QMetaType::Double}
+                };
+                // reset to origin value.
+                if (filterConvertType.contains(value.metaType())) {
+                    copy = value;
+                }
 #else
                 if (metaValue.type() == value.type())
                     return cache->setValue(key, value, configMeta->serial(key), cache->uid(), appid);
@@ -1304,6 +1314,13 @@ public:
                                      << ", and now type is " << value.type();
                     return false;
                 }
+
+                static const QVector<QVariant::Type> filterConvertType {
+                    QVariant::Double
+                };
+                if (filterConvertType.contains(value.type())) {
+                    copy = value;
+                }
 #endif
 
                 return cache->setValue(key, copy, configMeta->serial(key), cache->uid(), appid);
index 2c8a20c57e3f4fb6883b269c45c9649797b39cbc..eafabeee3154e0c1a0baf4b68890af86cc7769d1 100644 (file)
@@ -100,7 +100,7 @@ QByteArray DSGApplication::getId(qint64 pid)
 
     int pidfd = syscall(SYS_pidfd_open, pid, 0);
     if (pidfd < 0) {
-        qCWarning(dsgApp) << "pidfd open failed:" << strerror(errno);
+        qCWarning(dsgApp) << "pidfd open failed:" << strerror(errno) << ", the pid:" << pid;
         return QByteArray();
     }
 
@@ -109,6 +109,8 @@ QByteArray DSGApplication::getId(qint64 pid)
                         "org.desktopspec.ApplicationManager1");
 
     QDBusReply<QString> reply = infc.call("Identify", QVariant::fromValue(QDBusUnixFileDescriptor(pidfd)));
+    // see QDBusUnixFileDescriptor: The original file descriptor is not touched and must be closed by the user.
+    close(pidfd);
 
     if (!reply.isValid()) {
         qCWarning(dsgApp) << "Identify from AM failed." << reply.error().message();
index abe786f0f4458d3ed8b29ef204611ef67ed251f8..4063fab8daf902b21349cb54b3cdd22f2db9126e 100755 (executable)
       "permissions": "readwrite",
       "visibility": "public"
     },
+    "numberDouble": {
+      "value": 1.0,
+      "serial": 0,
+      "flags": ["global"],
+      "name": "double value type",
+      "permissions": "readwrite",
+      "visibility": "public"
+    },
     "array": {
       "value": ["value1", "value2"],
       "serial": 0,
index 8b301ce304b219fef057d232dbe1a7f568ffead5..9efb5d24766562df1625c7bb2a7294c4ebff1f27 100644 (file)
@@ -124,6 +124,11 @@ TEST_F(ut_DConfigFile, setValueTypeCheck) {
         ASSERT_FALSE(config.setValue("number", "1ab", "test", userCache.get()));
         ASSERT_EQ(config.value("number", userCache.get()).type(), type);
     }
+    {
+        const auto type = config.value("numberDouble", userCache.get()).type();
+        ASSERT_TRUE(config.setValue("numberDouble", 1.2, "test", userCache.get()));
+        ASSERT_EQ(config.value("numberDouble", userCache.get()), 1.2);
+    }
     {
         const auto type = config.value("array", userCache.get()).type();
         const QStringList array{"value1", "value2"};