Skip to content

fix: add null check for pa_context operations#117

Merged
fly602 merged 1 commit intolinuxdeepin:masterfrom
fly602:master
Feb 4, 2026
Merged

fix: add null check for pa_context operations#117
fly602 merged 1 commit intolinuxdeepin:masterfrom
fly602:master

Conversation

@fly602
Copy link
Contributor

@fly602 fly602 commented Feb 4, 2026

Added null pointer checks for pa_context operation results to prevent crashes when operations fail. Previously, pa_operation_unref was called directly on the operation result without checking if it was NULL, which could cause segmentation faults when PulseAudio operations failed.

The fix ensures that when pa_context_get_* functions return NULL (indicating operation failure), appropriate error messages are logged instead of dereferencing a null pointer. This addresses crashes that occurred when playing audio after login, likely due to PulseAudio context not being fully ready.

Influence:

  1. Test audio playback immediately after login
  2. Verify no crashes occur when PulseAudio services are unavailable
  3. Check error messages in logs when audio operations fail
  4. Test various audio sources and sinks to ensure stability

fix: 为pa_context操作添加空指针检查

添加了对pa_context操作结果的空指针检查,防止操作失败时发生崩溃。之前代码
直接对操作结果调用pa_operation_unref而没有检查是否为NULL,当PulseAudio操 作失败时可能导致段错误。

此修复确保当pa_context_get_*函数返回NULL(表示操作失败)时,会记录适当的
错误信息而不是解引用空指针。这解决了登录后播放音频时发生的崩溃问题,很可
能是由于PulseAudio上下文未完全就绪导致的。
PMS: BUG-334279
Influence:

  1. 测试登录后立即播放音频的功能
  2. 验证当PulseAudio服务不可用时不会发生崩溃
  3. 检查音频操作失败时的错误日志信息
  4. 测试各种音频源和接收器以确保稳定性

Added null pointer checks for pa_context operation results to prevent
crashes when operations fail. Previously, pa_operation_unref was called
directly on the operation result without checking if it was NULL, which
could cause segmentation faults when PulseAudio operations failed.

The fix ensures that when pa_context_get_* functions return NULL
(indicating operation failure), appropriate error messages are logged
instead of dereferencing a null pointer. This addresses crashes that
occurred when playing audio after login, likely due to PulseAudio
context not being fully ready.

Influence:
1. Test audio playback immediately after login
2. Verify no crashes occur when PulseAudio services are unavailable
3. Check error messages in logs when audio operations fail
4. Test various audio sources and sinks to ensure stability

fix: 为pa_context操作添加空指针检查

添加了对pa_context操作结果的空指针检查,防止操作失败时发生崩溃。之前代码
直接对操作结果调用pa_operation_unref而没有检查是否为NULL,当PulseAudio操
作失败时可能导致段错误。

此修复确保当pa_context_get_*函数返回NULL(表示操作失败)时,会记录适当的
错误信息而不是解引用空指针。这解决了登录后播放音频时发生的崩溃问题,很可
能是由于PulseAudio上下文未完全就绪导致的。
PMS: BUG-334279
Influence:
1. 测试登录后立即播放音频的功能
2. 验证当PulseAudio服务不可用时不会发生崩溃
3. 检查音频操作失败时的错误日志信息
4. 测试各种音频源和接收器以确保稳定性
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, mhduiy

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

@fly602 fly602 merged commit 09b3e44 into linuxdeepin:master Feb 4, 2026
16 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.

3 participants