Skip to content

feat: add dvd+rw-format support for DVD RW erase#347

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master
Jul 14, 2026
Merged

feat: add dvd+rw-format support for DVD RW erase#347
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master

Conversation

@Johnson-zs

@Johnson-zs Johnson-zs commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
  1. Added new DVDRwFormatEngine class to handle DVD RW erasure using
    dvd+rw-tools
  2. Modified control files to add dvd+rw-tools as a dependency
  3. Updated DOpticalDiscManager to detect DVD±RW media and use new engine
    when available
  4. Implemented progress parsing for dvd+rw-format's special output
    format
  5. Added fallback to xorriso when dvd+rw-format is not available

Log: Added support for DVD±RW erasure using dvd+rw-format tool

Influence:

  1. Test DVD+RW and DVD-RW erasure with dvd+rw-tools installed
  2. Verify fallback to xorriso when dvd+rw-tools is missing
  3. Check progress reporting during erase operations
  4. Test with different DVD RW media types
  5. Verify no regression in CD/DVD non-RW erase functionality

feat: 添加对DVD RW擦除的dvd+rw-format支持

  1. 新增DVDRwFormatEngine类用于通过dvd+rw-tools处理DVD RW擦除
  2. 修改控制文件添加dvd+rw-tools作为依赖项
  3. 更新DOpticalDiscManager以检测DVD±RW介质并在可用时使用新引擎
  4. 实现针对dvd+rw-format特殊输出格式的进度解析
  5. 添加当dvd+rw-format不可用时回退到xorriso的处理

Log: 新增使用dvd+rw-format工具进行DVD±RW擦除的支持

Influence:

  1. 测试dvd+rw-tools安装时的DVD+RW和DVD-RW擦除功能
  2. 验证dvd+rw-tools缺失时回退到xorriso的功能
  3. 检查擦除过程中的进度报告
  4. 使用不同类型的DVD RW介质进行测试
  5. 验证普通CD/DVD非RW擦除功能无回归

Summary by Sourcery

Add support for erasing DVD±RW media via a dedicated dvd+rw-format engine with progress reporting and fallback to existing xorriso-based erase.

New Features:

  • Introduce DVDRwFormatEngine to perform DVD±RW erase operations using the dvd+rw-format tool with progress updates.
  • Update DOpticalDiscManager to detect DVD±RW media and route erase operations through the new engine when dvd+rw-format is available.

Enhancements:

  • Improve erase progress reporting by parsing dvd+rw-format’s non-line-based output format.
  • Add a warning and automatic fallback to the existing xorriso-based erase path when dvd+rw-format is not present.

Build:

  • Declare dvd+rw-tools as a package dependency in Debian control files.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@sourcery-ai

sourcery-ai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduce a dedicated DVDRwFormatEngine that uses dvd+rw-format for DVD±RW erase, wire it into DOpticalDiscManager with media-type detection and progress parsing, add dvdrwformatengine implementation, and declare dvd+rw-tools as a package dependency while keeping xorriso as a fallback path.

Sequence diagram for DVD±RW erase flow with DVDRwFormatEngine and xorriso fallback

sequenceDiagram
    actor User
    participant DOpticalDiscManager
    participant DOpticalDiscInfo
    participant DVDRwFormatEngine
    participant DXorrisoEngine

    User->>DOpticalDiscManager: erase()
    DOpticalDiscManager->>DOpticalDiscInfo: createOpticalInfo(curDev)
    DOpticalDiscManager->>DOpticalDiscInfo: mediaType()
    DOpticalDiscManager->>DVDRwFormatEngine: doErase(curDev, mediaType)
    alt isDvdRw and dvd+rw-format found
        DVDRwFormatEngine->>DVDRwFormatEngine: doErase(dev, type)
        DVDRwFormatEngine-->>DOpticalDiscManager: jobStatusChanged(JobStatus, progress)
        DOpticalDiscManager-->>User: jobStatusChanged(JobStatus, progress, {}, {})
    else dvd+rw-format not found or not DVD±RW
        DOpticalDiscManager->>DXorrisoEngine: doErase(curDev)
        DXorrisoEngine-->>DOpticalDiscManager: jobStatusChanged(JobStatus, progress)
        DOpticalDiscManager-->>User: jobStatusChanged(JobStatus, progress, {}, {})
    end
Loading

Sequence diagram for dvd+rw-format progress parsing in DVDRwFormatEngine

sequenceDiagram
    participant DVDRwFormatEngine
    participant QProcess

    DVDRwFormatEngine->>QProcess: start(binary, args)
    QProcess-->>DVDRwFormatEngine: readyReadStandardOutput()
    DVDRwFormatEngine->>QProcess: readAllStandardOutput()
    DVDRwFormatEngine->>DVDRwFormatEngine: parseProgress(buffer)
    DVDRwFormatEngine-->>DVDRwFormatEngine: jobStatusChanged(JobStatus::kRunning, progress)
    QProcess-->>DVDRwFormatEngine: finished(exitCode)
    alt exitCode == 0
        DVDRwFormatEngine-->>DVDRwFormatEngine: jobStatusChanged(JobStatus::kFinished, 100)
    else exitCode != 0
        DVDRwFormatEngine-->>DVDRwFormatEngine: jobStatusChanged(JobStatus::kFailed, -1)
    end
Loading

File-Level Changes

Change Details Files
Route DVD±RW erase operations through DVDRwFormatEngine when dvd+rw-format is available, otherwise fall back to the existing xorriso flow.
  • Detect current media type via DOpticalDiscInfo before erase and determine if it is DVD+RW or DVD-RW.
  • Lookup the dvd+rw-format binary with QStandardPaths::findExecutable and gate the new erase path on its presence.
  • Instantiate DVDRwFormatEngine, connect its jobStatusChanged to DOpticalDiscManager’s jobStatusChanged (preserving progress/status reporting), and call doErase with current device and media type.
  • Emit a warning and continue to use DXorrisoEngine when dvd+rw-format is missing or for non-DVD±RW media.
src/dfm-burn/dfm-burn-lib/dopticaldiscmanager.cpp
Implement DVDRwFormatEngine to run dvd+rw-format, select appropriate arguments per media type, and parse its non-line-based progress output.
  • Add DVDRwFormatEngine QObject subclass with a doErase method and jobStatusChanged signal.
  • Inside doErase, locate dvd+rw-format, build argument list based on MediaType (force/full blank plus -gui), and start QProcess with merged output channels.
  • Use a QEventLoop tied to QProcess::finished to synchronously wait while streaming output through a buffer and calling parseProgress on readyReadStandardOutput.
  • Implement parseProgress using QRegularExpression to scan the entire buffer for the last XX.X% pattern, convert it to an int, and emit running progress updates below 100%.
  • On successful exit code emit finished with 100% progress; on failures emit failed and log warnings for missing binary, unsupported media type, start failures, or non-zero exit codes.
src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.cpp
src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.h
Declare dvd+rw-tools as a build/runtime dependency so the new erase engine can be used when available.
  • Update Debian packaging control files to add dvd+rw-tools to the dependency list.
  • Ensure both the template (control.in) and generated control reflect the new dependency for dfm-burn.
debian/control
debian/control.in

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • You already guard on dvd+rw-format availability in DOpticalDiscManager::erase; consider removing the second QStandardPaths::findExecutable call from DVDRwFormatEngine::doErase to avoid redundant lookups and simplify the flow.
  • In DVDRwFormatEngine::doErase, you use a nested QEventLoop with a QProcess; if this is called from UI or other event-driven contexts, it may be safer to run the process fully asynchronously (signals only) to avoid potential re-entrancy or blocking issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You already guard on dvd+rw-format availability in DOpticalDiscManager::erase; consider removing the second QStandardPaths::findExecutable call from DVDRwFormatEngine::doErase to avoid redundant lookups and simplify the flow.
- In DVDRwFormatEngine::doErase, you use a nested QEventLoop with a QProcess; if this is called from UI or other event-driven contexts, it may be safer to run the process fully asynchronously (signals only) to avoid potential re-entrancy or blocking issues.

## Individual Comments

### Comment 1
<location path="src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.cpp" line_range="98-101" />
<code_context>
+    //   0.0%\b\b\b\b0.1%\b|\b/\b\b0.2% ...
+    // 也有部分行带换行符(子进程的诊断输出、父进程结束时的 \n)。
+    // 在整个缓冲区中搜索最后一个 XX.X% 模式即可获取当前进度。
+    static const QRegularExpression re("([0-9]+\\.[0-9]+)%");
+    auto matches = re.globalMatch(QString::fromLocal8Bit(data));
+    QString lastPct;
+    while (matches.hasNext())
+        lastPct = matches.next().captured(1);
+    if (!lastPct.isEmpty()) {
</code_context>
<issue_to_address>
**issue (bug_risk):** Progress parsing is tightly coupled to a fractional XX.X% format and may miss integer-only percentages.

The regex currently only matches values like `10.0%` (`[0-9]+\.[0-9]+%`). If dvd+rw-format outputs `10%` (no decimal) or slightly changes its format, progress will stop updating without errors. Consider supporting both integer and fractional percentages, e.g. `([0-9]+(?:\.[0-9]+)?)%`, and tuning the pattern (anchoring/loosening) to match the documented output formats reliably.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.cpp Outdated
@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control,debian/control.in

@github-actions

Copy link
Copy Markdown
  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "debian/control": [
        {
            "line": "Homepage: http://www.deepin.org",
            "line_number": 33,
            "rule": "S35",
            "reason": "Url link | 6fe814dfb7"
        }
    ]
}

@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control.in

1. Added new DVDRwFormatEngine class to handle DVD RW erasure using
dvd+rw-tools
2. Modified control files to add dvd+rw-tools as a dependency
3. Updated DOpticalDiscManager to detect DVD±RW media and use new engine
when available
4. Implemented progress parsing for dvd+rw-format's special output
format
5. Added fallback to xorriso when dvd+rw-format is not available

Log: Added support for DVD±RW erasure using dvd+rw-format tool

Influence:
1. Test DVD+RW and DVD-RW erasure with dvd+rw-tools installed
2. Verify fallback to xorriso when dvd+rw-tools is missing
3. Check progress reporting during erase operations
4. Test with different DVD RW media types
5. Verify no regression in CD/DVD non-RW erase functionality

feat: 添加对DVD RW擦除的dvd+rw-format支持

1. 新增DVDRwFormatEngine类用于通过dvd+rw-tools处理DVD RW擦除
2. 修改控制文件添加dvd+rw-tools作为依赖项
3. 更新DOpticalDiscManager以检测DVD±RW介质并在可用时使用新引擎
4. 实现针对dvd+rw-format特殊输出格式的进度解析
5. 添加当dvd+rw-format不可用时回退到xorriso的处理

Log: 新增使用dvd+rw-format工具进行DVD±RW擦除的支持

Influence:
1. 测试dvd+rw-tools安装时的DVD+RW和DVD-RW擦除功能
2. 验证dvd+rw-tools缺失时回退到xorriso的功能
3. 检查擦除过程中的进度报告
4. 使用不同类型的DVD RW介质进行测试
5. 验证普通CD/DVD非RW擦除功能无回归
@github-actions

Copy link
Copy Markdown
  • 检测到debian目录文件有变更: debian/control.in

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:93分

■ 【总体评价】

代码实现了DVD±RW介质擦除功能,通过引入dvd+rw-format工具替代原有xorriso路径,设备路径校验和进程管理逻辑完善
逻辑正确且无安全漏洞,因注释误导和缺少超时机制扣7分

■ 【详细分析】

  • 1.语法逻辑(基本正确)✓

DOpticalDiscManager::erase()中新增DVD±RW介质类型判断和新引擎调用路径,逻辑清晰。DVDRwFormatEngine::doErase()中设备路径校验、二进制查找、参数构造、进程启动和退出码检查均正确。parseProgress()中多阶段加权进度计算逻辑合理,相位切换检测使用5%回退阈值是合理启发式。QScopedPointer管理DOpticalDiscInfoDVDRwFormatEngine生命周期正确,无内存泄漏。
潜在问题:doErase()while (proc.state() == QProcess::Running)循环无整体超时机制,若dvd+rw-format因硬件故障挂起,将导致调用线程永久阻塞;注释声称waitForReadyRead内部调用processEvents是事实性错误,实际QIODevice::waitForReadyRead是阻塞式I/O多路复用调用,信号能传递是因为Qt::DirectConnection使信号同步发射
建议:增加整体超时机制,使用QElapsedTimer记录已运行时间,超过阈值后调用proc.kill()终止进程;修正waitForReadyRead相关注释,说明信号传递机制实际依赖Qt::DirectConnection而非processEvents

  • 2.代码质量(良好)✓

命名规范与项目风格一致,doEraseparseProgressDVDRwFormatEngine等命名清晰。doErase()中关于dvd+rw-format进度输出机制的注释详尽,有助于维护者理解SCSI操作的多阶段特性。buffer截断策略buffer.right(512)有效防止内存无限增长。错误路径均通过Q_EMIT jobStatusChanged通知上层,错误处理完整。
潜在问题:~DVDRwFormatEngine()析构函数为空,可使用= default;缺少Q_DISABLE_COPY宏防止拷贝;phaselastRawProgress作为成员变量在doErase开头重置,若对象被复用于并发调用会有竞态风险;doErase()中关于processEvents的注释描述与Qt实际行为不符
建议:析构函数改为~DVDRwFormatEngine() = default;;添加Q_DISABLE_COPY(DVDRwFormatEngine);考虑将phaselastRawProgress作为doErase的局部变量并通过引用传递给parseProgress,消除成员状态依赖;修正processEvents相关注释

  • 3.代码性能(良好)✓

200ms轮询间隔对光盘擦除场景合理,不会造成CPU空转。buffer限制在1024字节内,parseProgress中正则表达式声明为static const仅编译一次。QProcess::MergedChannels合并标准输出和错误输出,减少管道数量。进程退出后主动读取剩余管道数据,避免进度丢失。
潜在问题:globalMatch每次调用都会遍历整个buffer查找所有匹配,但仅需最后一个匹配值
建议:可改用QRegularExpression::match从字符串末尾反向查找,或使用lastIndexOf优化,但当前buffer上限1024字节性能影响可忽略

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
代码使用QProcess::start(binary, args)参数列表形式启动外部进程,不经过shell,无命令注入风险。设备路径通过QDir::cleanPath解析后使用startsWith("/dev/sr")校验,cleanPath会解析"."和".."组件,路径遍历如/dev/sr0/../../etc/passwd会被解析为/etc/passwd后被校验拒绝。dvd+rw-format二进制通过QStandardPaths::findExecutable查找,在桌面应用场景下风险可控。介质类型MediaType为枚举类型,无法注入。args参数列表由硬编码字符串和已校验的cleanDev组成,无注入风险。

  • 建议:无需额外安全修复,当前安全措施充分

■ 【改进建议代码示例】

--- a/src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.h
+++ b/src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.h
@@ -18,9 +18,12 @@ class DVDRwFormatEngine : public QObject
     Q_OBJECT
 
 public:
     explicit DVDRwFormatEngine(QObject *parent = nullptr);
-    ~DVDRwFormatEngine() override;
+    ~DVDRwFormatEngine() override = default;
 
     bool doErase(const QString &dev, MediaType type);
 
+private:
+    Q_DISABLE_COPY(DVDRwFormatEngine)
+
 Q_SIGNALS:
     void jobStatusChanged(JobStatus status, int progress);

--- a/src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.cpp
+++ b/src/dfm-burn/dfm-burn-lib/private/dvdrwformatengine.cpp
@@ -88,12 +88,14 @@ bool DVDRwFormatEngine::doErase(const QString &dev, MediaType type)
     Q_EMIT jobStatusChanged(JobStatus::kRunning, 0);
 
-    // dvd+rw-format 进度输出机制分析(源码 dvd+rw-format.cpp):
-    //
-    // 1. fork() 后子进程 setsid() 执行 SCSI 操作,父进程安装 SIGALRM
-    //    定时轮询共享内存中的 progress 值(0~65536),用退格符覆盖式
-    //    输出百分比到 stderr。
-    //
-    // 2. -gui 标志的 gui_action 赋值在 fork 之后的子进程中(727 行),
-    //    父进程的 gui_action 始终为 NULL(129 行),所以 -gui 对父进程
-    //    的进度输出格式无影响——父进程始终用 \b 退格覆盖方式。
-    //
-    // 3. DVD+RW -force 路径有 3 个 wait_for_unit(progress) 调用
-    //    (FORMAT UNIT → STOP DE-ICING → CLOSE SESSION),
-    //    每个 SCSI 操作的进度指示器独立从 0 开始,
-    //    导致原始输出出现 3 个 0→100% 周期。
-    //    DVD-RW -blank 路径只有 1 个 wait_for_unit,单周期。
-    //
-    // 4. 进度数据通过 stderr 管道传输。QProcess::readyReadStandardOutput
-    //    信号在 QEventLoop + MergedChannels 下可能不能及时触发(尤其在
-    //    DVD-RW 单阶段输出稀疏时)。改用 waitForReadyRead 主动轮询
-    //    管道——其内部调用 processEvents 处理 Qt 信号,进度可实时传递。
+    // dvd+rw-format 进度输出机制分析(源码 dvd+rw-format.cpp):
+    // 父进程用退格符覆盖式输出百分比到 stderr,DVD+RW -force 有 3 个
+    // SCSI 操作阶段(FORMAT UNIT → STOP DE-ICING → CLOSE SESSION),
+    // DVD-RW -blank 只有 1 个阶段。使用 waitForReadyRead 主动轮询管道,
+    // 信号通过 Qt::DirectConnection 同步传递给上层,无需 processEvents。
 
     int totalPhases = (type == MediaType::kDVD_PLUS_RW) ? 3 : 1;
@@ -108,11 +110,19 @@ bool DVDRwFormatEngine::doErase(const QString &dev, MediaType type)
     proc.start(binary, args);
     if (!proc.waitForStarted()) {
         qWarning() << "[dfm-burn] Failed to start dvd+rw-format";
         Q_EMIT jobStatusChanged(JobStatus::kFailed, -1);
         return false;
     }
 
-    // 主动轮询管道,不依赖 readyReadStandardOutput 信号。
-    // waitForReadyRead 内部调用 processEvents,emit 的信号能被上层接收。
+    // 主动轮询管道,不依赖 readyReadStandardOutput 信号。
+    // 信号通过 Qt::DirectConnection 同步传递,无需事件循环处理。
     const int pollInterval { 200 };   // ms
+    const qint64 timeoutMs { 30 * 60 * 1000 };  // 30 分钟超时
+    QElapsedTimer timer;
+    timer.start();
 
     while (proc.state() == QProcess::Running) {
+        if (timer.hasExpired(timeoutMs)) {
+            qWarning() << "[dfm-burn] dvd+rw-format timed out after" << timeoutMs << "ms";
+            proc.kill();
+            proc.waitForFinished(5000);
+            Q_EMIT jobStatusChanged(JobStatus::kFailed, -1);
+            return false;
+        }
         proc.waitForReadyRead(pollInterval);
 
         if (proc.bytesAvailable() > 0) {

@Johnson-zs

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 236f0d4 into linuxdeepin:master Jul 14, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants