[gnome-music/wip/mschraal/grilo-destructor] coregrilo: Deinitialize Grilo on shutdown



commit 581a0ef44a5162dbc3e6e9ae8467da32e23abc49
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Mar 29 23:19:08 2020 +0200

    coregrilo: Deinitialize Grilo on shutdown
    
    Always call Grl.deinit() on shutdown.
    
    Related: #82

 gnomemusic/coregrilo.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index 4d408acf..498ce5bb 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -22,6 +22,8 @@
 # code, but you are not obligated to do so.  If you do not wish to do so,
 # delete this exception statement from your version.
 
+import weakref
+
 import gi
 gi.require_version('Grl', '0.3')
 from gi.repository import Grl, GLib, GObject
@@ -90,6 +92,8 @@ class CoreGrilo(GObject.GObject):
 
         self._registry.load_all_plugins(True)
 
+        weakref.finalize(self, Grl.deinit)
+
     def _on_tracker_available_changed(self, klass, value):
         new_state = self._tracker_wrapper.props.tracker_available
         # FIXME:No removal support yet.


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