From 9167e6441c239ea912bbcce0ac0855cf47163f3f Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sat, 13 Nov 2010 21:38:16 -0500 Subject: [PATCH] Quit plugins on exit Plugins should have a chance to clean up after themselves when we are shutting down. --- libsaria/__init__.py | 2 ++ libsaria/plugin.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/libsaria/__init__.py b/libsaria/__init__.py index e9a6b14b..bdfa1ad6 100644 --- a/libsaria/__init__.py +++ b/libsaria/__init__.py @@ -65,4 +65,6 @@ def startup(): def shutdown(): event.start("PREQUIT") + import plugin + plugin.quit() event.start("POSTQUIT") diff --git a/libsaria/plugin.py b/libsaria/plugin.py index 3b49e80d..9cf99f03 100644 --- a/libsaria/plugin.py +++ b/libsaria/plugin.py @@ -22,6 +22,14 @@ def init(): if p_dir == None: p_dir = path.plugin_dir() +def quit(): + global loaded + for mod in loaded: + try: + loaded[mod].stop() + except: + pass + def install_once(filepath): global install