[winswitch] PATCH: Fix crash when querying for sound codecs

Timothy Hobbs timothy at hobbs.cz
Sat Dec 31 11:55:09 GMT 2016


This patch fixes a crash when querying for sound codecs:

===================================================================
--- trunk/src/xpra/sound/pulseaudio/pulseaudio_pactl_util.py (revision 
14668)
+++ trunk/src/xpra/sound/pulseaudio/pulseaudio_pactl_util.py (working copy)
@@ -58,7 +58,7 @@
  def is_pa_installed():
      pactl_bin = get_pactl_bin()
      log("is_pa_installed() pactl_bin=%s", pactl_bin)
-    return len(pactl_bin)>0
+    return pactl_bin is not None and len(pactl_bin)>0

  def has_pa():
      global has_pulseaudio


Patch tested on debian stretch in Docker with the latest subversion repo.

Here is the crash that is being fixed:

$ PYTHONPATH=`ls -d install/lib*/python`:$PYTHONPATH ./install/bin/xpra 
_sound_query
xpra main error:
Traceback (most recent call last):
   File "/pwd/src/install/lib/python/xpra/scripts/main.py", line 135, in 
main
     return run_mode(script_file, err, options, args, mode, defaults)
   File "/pwd/src/install/lib/python/xpra/scripts/main.py", line 1212, 
in run_mode
     return run_sound(mode, error_cb, options, args)
   File "/pwd/src/install/lib/python/xpra/sound/wrapper.py", line 147, 
in run_sound
     sources = [x for x in get_source_plugins() if x in plugins]
   File "/pwd/src/install/lib/python/xpra/sound/gstreamer_util.py", line 
527, in get_source_plugins
     if has_pa():
   File 
"/pwd/src/install/lib/python/xpra/sound/pulseaudio/pulseaudio_pactl_util.py", 
line 66, in has_pa
     has_pulseaudio = get_pulse_server_x11_property() or is_pa_installed()
   File 
"/pwd/src/install/lib/python/xpra/sound/pulseaudio/pulseaudio_pactl_util.py", 
line 61, in is_pa_installed
     return pact_bin is not None and len(pactl_bin)>0
NameError: global name 'pact_bin' is not defined




More information about the shifter-users mailing list