Skip to content

Commit

Permalink
* introduce signal_cleanup so we can run cleanup things from the sign…
Browse files Browse the repository at this point in the history
…al handler (non UI things)

* move stop_all_sound early, since it is asynchronous / kills processes

git-svn-id: https://xpra.org/svn/Xpra/trunk@9337 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 13, 2015
1 parent fd7f992 commit 23e87db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/xpra/client/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def app_signal(signum, frame):
sys.stderr.flush()
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.signal_cleanup()
self.timeout_add(0, self.disconnect_and_quit, 128 + signum, "exit on signal %s" % SIGNAMES.get(signum, signum))
signal.signal(signal.SIGINT, app_signal)
signal.signal(signal.SIGTERM, app_signal)
Expand All @@ -181,6 +182,11 @@ def signal_disconnect_and_quit(self, exit_code, reason):
self.disconnect_and_quit(exit_code, reason)
self.quit(exit_code)

def signal_cleanup(self):
#placeholder for stuff that can be cleaned up from the signal handler
#(non UI thread stuff)
pass

def disconnect_and_quit(self, exit_code, reason):
#try to tell the server we're going, then quit
log("disconnect_and_quit(%s, %s)", exit_code, reason)
Expand Down
11 changes: 10 additions & 1 deletion src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def quit(self, exit_code=0):
def cleanup(self):
log("UIXpraClient.cleanup()")
XpraClientBase.cleanup(self)
self.stop_all_sound()
for x in (self.keyboard_helper, self.clipboard_helper, self.tray, self.notifier, self.menu_helper, self.client_extras, getVideoHelper()):
if x is None:
continue
Expand All @@ -380,12 +381,20 @@ def cleanup(self):
#(cleaner and needed when we run embedded in the client launcher)
self.destroy_all_windows()
self.clean_mmap()
reaper_cleanup()
log("UIXpraClient.cleanup() done")

def stop_all_sound(self):
if self.sound_source:
self.stop_sending_sound()
if self.sound_sink:
self.stop_receiving_sound()

def signal_cleanup(self):
XpraClientBase.signal_cleanup(self)
self.stop_all_sound()
reaper_cleanup()
log("UIXpraClient.cleanup() done")


def destroy_all_windows(self):
for wid, window in self._id_to_window.items():
Expand Down

0 comments on commit 23e87db

Please sign in to comment.