fix: add null check for pa_context operations#117
Merged
fly602 merged 1 commit intolinuxdeepin:masterfrom Feb 4, 2026
Merged
Conversation
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. 测试各种音频源和接收器以确保稳定性
mhduiy
approved these changes
Feb 4, 2026
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
fix: 为pa_context操作添加空指针检查
添加了对pa_context操作结果的空指针检查,防止操作失败时发生崩溃。之前代码
直接对操作结果调用pa_operation_unref而没有检查是否为NULL,当PulseAudio操 作失败时可能导致段错误。
此修复确保当pa_context_get_*函数返回NULL(表示操作失败)时,会记录适当的
错误信息而不是解引用空指针。这解决了登录后播放音频时发生的崩溃问题,很可
能是由于PulseAudio上下文未完全就绪导致的。
PMS: BUG-334279
Influence: