[longomatch] Shutdown multimedia backends on exit



commit e2f65326dc65b2503872d7cfc0b720192042a3b2
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Sep 6 22:36:14 2014 +0200

    Shutdown multimedia backends on exit

 LongoMatch.Addins/AddinsManager.cs                 |    7 +++++++
 .../ExtensionPoints/IMultimediaBackend.cs          |    1 +
 LongoMatch/Main.cs                                 |    7 ++++++-
 3 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index 11e4afd..fb48b12 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -79,6 +79,13 @@ namespace LongoMatch.Addins
                                }
                        }
                }
+               
+               public void ShutdownMultimediaBackends ()
+               {
+                       foreach (IMultimediaBackend backend in 
AddinManager.GetExtensionObjects<IMultimediaBackend> ()) {
+                               backend.Shutdown ();
+                       }
+               }
        }
 }
 
diff --git a/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs 
b/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
index ed2c59a..f5f194a 100644
--- a/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
+++ b/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
@@ -29,5 +29,6 @@ namespace LongoMatch.Addins.ExtensionPoints
        public interface IMultimediaBackend
        {
                void RegisterElements (IMultimediaToolkit mtoolkit);
+               void Shutdown ();
        }
 }
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 784ad38..f92a904 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -38,6 +38,7 @@ namespace LongoMatch
                
                public static void Main (string[] args)
                {
+                       AddinsManager manager = null;
                        CoreServices.Init ();
 
                        InitGtk ();
@@ -51,7 +52,7 @@ namespace LongoMatch
                        Version version = Assembly.GetExecutingAssembly ().GetName ().Version;
 
                        try {
-                               AddinsManager manager = new AddinsManager (Config.PluginsConfigDir, 
Config.PluginsDir);
+                               manager = new AddinsManager (Config.PluginsConfigDir, Config.PluginsDir);
                                manager.LoadConfigModifierAddins ();
                                Config.DrawingToolkit = new CairoBackend ();
                                Config.EventsBroker = new EventsBroker ();
@@ -73,6 +74,10 @@ namespace LongoMatch
                                Application.Run ();
                        } catch (Exception ex) {
                                ProcessExecutionError (ex);
+                       } finally {
+                               if (manager != null) {
+                                       manager.ShutdownMultimediaBackends ();
+                               }
                        }
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]