Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: Check the key before invoking g_hash_table_remove #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Miouyouyou
Copy link

Turns out that I hit a bug where pa_stream_unref would
call g_hash_table_remove with a NULL key.

Thanks for the lightweight and smooth error handling from
Glib, g_hash_table_remove generated an ABORT call, crashing
the Unity3D games (e.g. Wizards of Legend) I was trying to start.

Now, I discovered that g_hash_table_lookup CANNOT be called with a NULL
key. That also generate a crash... Ugh...

So, yeah, basically to avoid this bug, run the game and get some nice sound
in the headphones, here's what I did :

  • check that the key is not NULL (0)
  • check that the key is actually inside the Hash table
  • and THEN call g_hash_table_remove.

Note, here's my ~/.asoundrc, just in case :

defaults.pcm.!card Audio
defaults.ctl.!card Audio

Audio being a FiiO USB device where my headphones are connected to :

card 3: Audio [DigiHug USB Audio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 3: Audio [DigiHug USB Audio], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Signed-off-by: Miouyouyou (Myy) myy@miouyouyou.fr

Turns out that I hit a bug where pa_stream_unref would
call g_hash_table_remove with a NULL key.

Thanks for the lightweight and smooth error handling from
Glib, g_hash_table_remove generated an ABORT call, crashing
some Unity3D games I was trying to start.
Now, you also CANNOT call g_hash_table_lookup with a NULL
key. That also generate a crash... Ugh...

So, yeah, we first check that the key is not 0, then check
if the key is actually inside the Hash table and THEN remove
it.

Note, here's my ~/.asoundrc, just in case :
defaults.pcm.!card Audio
defaults.ctl.!card Audio

Audio being :
card 3: Audio [DigiHug USB Audio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 3: Audio [DigiHug USB Audio], device 1: USB Audio [USB Audio i-rinat#1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I'm using a FiiO device for sound output.

Signed-off-by: Miouyouyou (Myy) <myy@miouyouyou.fr>
@Miouyouyou
Copy link
Author

I guess that this might not be the good way (TM) of handling such bugs. Searching for why the key is NULL at this point would be far better, but I didn't have enough time to delve into this and... the fix works !

@Miouyouyou
Copy link
Author

I guess that this might also fix bug #98

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.

None yet

1 participant