Ticket #533: osx-sound-autoreleasepool.patch
File osx-sound-autoreleasepool.patch, 2.4 KB (added by , 6 years ago) |
---|
-
src/xpra/net/subprocess_wrapper.py
36 36 #avoids showing a new console window on win32: 37 37 WIN32_SHOWWINDOW = os.environ.get("XPRA_WIN32_SHOWWINDOW", "0")=="1" 38 38 39 import gtk 40 gtk.threads_init() 41 class mainloop(object): 42 def run(self): 43 gtk.main() 44 def quit(self): 45 gtk.main_quit() 39 46 47 40 48 class subprocess_callee(object): 41 49 """ 42 50 This is the callee side, wrapping the gobject we want to interact with. … … 47 55 (there is no validation of which signals are valid or not) 48 56 """ 49 57 def __init__(self, input_filename="-", output_filename="-", wrapped_object=None, method_whitelist=None): 50 self.mainloop = gobject.MainLoop()58 self.mainloop = mainloop() 51 59 self.name = "" 52 60 self.input_filename = input_filename 53 61 self.output_filename = output_filename -
src/xpra/sound/wrapper.py
3 3 # Xpra is released under the terms of the GNU GPL v2, or, at your option, any 4 4 # later version. See the file COPYING for details. 5 5 6 import sys 6 7 import os 7 8 import time 8 9 … … 103 104 else: 104 105 raise Exception("unknown mode: %s" % mode) 105 106 107 #ugly OSX code to avoid auto-release warnings 108 auto_release_pool = None 109 if sys.platform.startswith("darwin"): 110 try: 111 import objc #@UnresolvedImport 112 NSAutoreleasePool = objc.lookUpClass("NSAutoreleasePool") 113 auto_release_pool = NSAutoreleasePool.alloc() 114 auto_release_pool.init() 115 log("autorelease pool=%s", auto_release_pool) 116 except: 117 log.warn("failed to allocate autorelease pool", exc_info=True) 118 auto_release_pool = None 119 106 120 #the plugin to use (ie: 'pulsesrc' for src.py or 'autoaudiosink' for sink.py) 107 121 plugin = args[2] 108 122 #plugin options (ie: "device=monitor_device,something=value") … … 127 141 log.error("run_sound%s error", (mode, error_cb, options, args), exc_info=True) 128 142 return 1 129 143 finally: 144 del auto_release_pool 130 145 if ss: 131 146 ss.stop() 132 147