when i change system volume with my keyboard, earcandy crashes.

Bug #963954 reported by AndiTheBest
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ear Candy
New
Undecided
Unassigned

Bug Description

Hi,

always when i change system volume with my keyboard, i get the following error:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/earcandy/PulseAudio.py", line 166, in pa_sink_input_info_cb
    self.pa_create_monitor_stream_for_sink_input(sink_input.index, self.sinks_by_id[sink_input.sink].monitor_source, sink_input.name, s.client.description)
AttributeError: 'NoneType' object has no attribute 'description'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/earcandy/EarCandy.py", line 283, in __adjust_volumes
    if sink.set_volume():
  File "/usr/lib/pymodules/python2.7/earcandy/SinkInput.py", line 83, in set_volume
    if step_volume < self.client.volume_step:

and earcandy crashes.
I don't know exactly what i have done, because i don't know the code and i'm a python noob, but changing this:

    # SINK INPUTS
    def pa_sink_input_info_cb(self, sink_input, user_data):
        target_sink = self.prefer_sink_index

        if not self.sink_inputs.has_key(sink_input.index):
            s = SinkInput(sink_input.index, sink_input.name, sink_input.volume, sink_input.sink, sink_input.media_role)
            self.sink_inputs[s.index] = s

            if self.clients_by_id.has_key(sink_input.client):
                client = self.clients_by_id[sink_input.client]
                client.sinks[s.index] = s
                s.client = client

                # Skim client role from 1st stream
                if not client.role and sink_input.media_role:
                    client.role = sink_input.media_role
                    log.info("new client media role : %s %s " % (client.name, sink_input.media_role))

            self.pa_create_monitor_stream_for_sink_input(sink_input.index, self.sinks_by_id[sink_input.sink].monitor_source, sink_input.name, s.client.description)
            log.info("new sink input : %s %s " % (s.client.description, s.name))

to this:

    # SINK INPUTS
    def pa_sink_input_info_cb(self, sink_input, user_data):
        target_sink = self.prefer_sink_index

        if not self.sink_inputs.has_key(sink_input.index):

            if self.clients_by_id.has_key(sink_input.client):
                s = SinkInput(sink_input.index, sink_input.name, sink_input.volume, sink_input.sink, sink_input.media_role) #CHANGE #1
                self.sink_inputs[s.index] = s #CHANGE #2

                client = self.clients_by_id[sink_input.client]
                client.sinks[s.index] = s
                s.client = client

                # Skim client role from 1st stream
                if not client.role and sink_input.media_role:
                    client.role = sink_input.media_role
                    log.info("new client media role : %s %s " % (client.name, sink_input.media_role))

                self.pa_create_monitor_stream_for_sink_input(sink_input.index, self.sinks_by_id[sink_input.sink].monitor_source, sink_input.name, s.client.description) #CHANGE #3
                log.info("new sink input : %s %s " % (s.client.description, s.name) ) #CHANGE #4

works.
The problem is, SinkInput.client won't be set if self.clients_by_id.has_key(sink_input.client) is false.

Apart from that, nice app!

Regards, Andi

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.