We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5256 - [PATCH] Don't assign context variables until pulse audio has connected.
Summary: [PATCH] Don't assign context variables until pulse audio has connected.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-14 03:26 UTC by Alistair Leslie-Hughes
Modified: 2020-12-09 14:49 UTC (History)
2 users (show)

See Also:


Attachments
Dont assign the context patch. (2.27 KB, patch)
2020-08-14 03:26 UTC, Alistair Leslie-Hughes
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alistair Leslie-Hughes 2020-08-14 03:26:12 UTC
Created attachment 4436 [details]
Dont assign the context patch.

When pulse audio fails to connect to the sever we have two variables that have been initialized which cause asserts in pa when the CloseDevice is called.

SDL correct detects that we have failed to connect, when the it attempts to die the close_device, we get the follow error

Assertion 'pa_atomic_load(&(c)->_ref) >= 1' failed at pulse/context.c:1055, function pa_context_disconnect(). Aborting.

This then crashes the application.

Attached is a patch, which only assigns the passed in variables once a successfully connection to Pulse Audio server has been made.
Comment 1 Sam Lantinga 2020-12-09 14:49:16 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/48bfca44e385