yktoo / indicator-sound-switcher

Sound input/output selector indicator for Linux
https://yktoo.com/en/software/sound-switcher-indicator/
GNU General Public License v3.0
370 stars 29 forks source link

NULL pointer access when no active port available on a device #8

Closed yktoo closed 10 years ago

yktoo commented 10 years ago

Reported by @qris

I get some assertion errors on the console:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "/usr/bin/indicator-sound-switcher", line 306, in pacb_sink_info
    struct.contents.active_port)
  File "/usr/bin/indicator-sound-switcher", line 373, in sink_info
    sink.activate_port_by_name(active_port.contents.name)
ValueError: NULL pointer access
yktoo commented 10 years ago

@qris what did you do when this happened?

qris commented 10 years ago

It happens every time I choose Refresh from the applet menu.

yktoo commented 10 years ago

Which version of Ubuntu do you run? Also, could you uncomment the print statement in the _log method (in /usr/bin/indicator-sound-switcher), reproduce the error and send me the output?

qris commented 10 years ago

I'm running 12.04 LTS. I get this one on startup:

chris@lap-x201:~/Downloads$ /tmp/indicator-sound-switcher 
Context connected
    + Source[1] addition: 'alsa_input.pci-0000_00_1b.0.analog-stereo'
        + Source port[0] added: 'analog-input-microphone-internal'; 'Internal Microphone'; 8900
        + Source port[1] added: 'analog-input-microphone-dock'; 'Dock Microphone'; 7800
        + Source port[2] added: 'analog-input-microphone'; 'Microphone'; 8700
    + Sink[0] addition: 'alsa_output.pci-0000_00_1b.0.analog-stereo'
        + Sink port[0] added: 'analog-output-speaker'; 'Speakers'; 10000
        + Sink port[1] added: 'analog-output-headphones'; 'Headphones'; 9000
    + Sink[2] addition: 'bluez_sink.00_02_3C_2A_02_28'
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 314, in 'calling callback function'
File "/tmp/indicator-sound-switcher", line 306, in pacb_sink_info
    struct.contents.active_port)
File "/tmp/indicator-sound-switcher", line 373, in sink_info
    sink.activate_port_by_name(active_port.contents.name)
ValueError: NULL pointer access

And this (looks the same) when I choose Refresh from the drop-down menu:

    - Source[1] removed: 'alsa_input.pci-0000_00_1b.0.analog-stereo'
    - Sink[0] removed: 'alsa_output.pci-0000_00_1b.0.analog-stereo'
    - Sink[2] removed: 'bluez_sink.00_02_3C_2A_02_28'
    + Source[1] addition: 'alsa_input.pci-0000_00_1b.0.analog-stereo'
        + Source port[0] added: 'analog-input-microphone-internal'; 'Internal Microphone'; 8900
        + Source port[1] added: 'analog-input-microphone-dock'; 'Dock Microphone'; 7800
        + Source port[2] added: 'analog-input-microphone'; 'Microphone'; 8700
    + Sink[0] addition: 'alsa_output.pci-0000_00_1b.0.analog-stereo'
        + Sink port[0] added: 'analog-output-speaker'; 'Speakers'; 10000
        + Sink port[1] added: 'analog-output-headphones'; 'Headphones'; 9000
    + Sink[2] addition: 'bluez_sink.00_02_3C_2A_02_28'
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 314, in 'calling callback function'
File "/tmp/indicator-sound-switcher", line 306, in pacb_sink_info
    struct.contents.active_port)
File "/tmp/indicator-sound-switcher", line 373, in sink_info
    sink.activate_port_by_name(active_port.contents.name)
ValueError: NULL pointer access

Cheers, Chris.

yktoo commented 10 years ago

Managed to reproduce it on 12.04, only seems to impact Bluetooth devices. Will continue to investigate.

yktoo commented 10 years ago

Fix committed.