From edf4ba4575bbb9b5234bef2b52fe9f66ed95ae6c Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 10 Apr 2015 12:38:08 +0000 Subject: [PATCH] #669: define a cleanup method used by the sound wrapper to stop the sound pipeline before the real stop code (makes the code easier to read) git-svn-id: https://xpra.org/svn/Xpra/trunk@8987 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/net/subprocess_wrapper.py | 6 ++++++ src/xpra/sound/wrapper.py | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xpra/net/subprocess_wrapper.py b/src/xpra/net/subprocess_wrapper.py index 533a60bf50..912aa2a9fc 100644 --- a/src/xpra/net/subprocess_wrapper.py +++ b/src/xpra/net/subprocess_wrapper.py @@ -152,7 +152,12 @@ def net_stop(self): log("net_stop() will call stop from main thread") gobject.idle_add(self.stop) + + def cleanup(self): + pass + def stop(self): + self.cleanup() p = self.protocol log("stop() protocol=%s", p) if p: @@ -169,6 +174,7 @@ def handle_signal(self, sig, frame): signame = SIGNAMES.get(sig, sig) log("handle_signal(%s, %s) calling stop from main thread", signame, frame) self.send("signal", signame) + self.cleanup() #give time for the network layer to send the signal message gobject.timeout_add(150, self.stop) diff --git a/src/xpra/sound/wrapper.py b/src/xpra/sound/wrapper.py index dd7ceb26be..be269ef927 100644 --- a/src/xpra/sound/wrapper.py +++ b/src/xpra/sound/wrapper.py @@ -54,16 +54,13 @@ def start(self): gobject.idle_add(self.wrapped_object.start) subprocess_callee.start(self) - def stop(self): + def cleanup(self): wo = self.wrapped_object log("stop() wrapped object=%s", wo) if wo: #this will stop the sound pipeline: self.wrapped_object = None wo.cleanup() - #this will stop the protocol and main loop - #so call it with a delay so the sound pipeline can shutdown cleanly - gobject.timeout_add(250, subprocess_callee.stop, self) def export_info(self): wo = self.wrapped_object