Skip to content

Commit

Permalink
#669: define a cleanup method used by the sound wrapper to stop the s…
Browse files Browse the repository at this point in the history
…ound 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
  • Loading branch information
totaam committed Apr 10, 2015
1 parent e3721b8 commit edf4ba4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/xpra/net/subprocess_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down
5 changes: 1 addition & 4 deletions src/xpra/sound/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit edf4ba4

Please sign in to comment.