From 497ed826ff03125b5c6748046305273bd097048d Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 31 Jul 2026 16:40:44 +0800 Subject: [PATCH] fix(gpu): fix GPU VRAM size parsing failure on multi-line gpu-info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split gpu-info by single "\n" and parse each line separately instead of splitting the whole content by "\n\n" and ":" on the entire string. 修复多行gpu-info文件显存大小解析失败的问题,改为逐行分割解析。 Log: 修复显存大小解析失败问题 PMS: BUG-372403 Influence: 修复后含多行的gpu-info文件能正确解析显存大小并显示。 --- deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp index e8c92145..db419adc 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceGpu.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -192,14 +192,14 @@ bool DeviceGpu::setHwinfoInfo(const QMap &mapInfo) if (file.open(QIODevice::ReadOnly)) { qCDebug(appLog) << "gpu-info file opened successfully."; QString allStr(file.readAll()); - QStringList items = allStr.split("\n\n"); + QStringList items = allStr.split("\n"); file.close(); foreach (const QString &item, items) { if (item.isEmpty()) { // qCDebug(appLog) << "Skipping empty item in gpu-info."; continue; } - QStringList tmpItems = allStr.split(":", QT_SKIP_EMPTY_PARTS); + QStringList tmpItems = item.split(":", QT_SKIP_EMPTY_PARTS); if (tmpItems.size() != 2) { // qCDebug(appLog) << "Skipping item with incorrect size in gpu-info: " << item; continue;