Commit 09b3e44
authored
fix: add null check for pa_context operations (#117)
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. 测试各种音频源和接收器以确保稳定性1 parent 1fdf101 commit 09b3e44
1 file changed
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
66 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
88 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
89 | 104 | | |
90 | 105 | | |
91 | 106 | | |
| |||
0 commit comments