From b27c9ee6302dc3f4b5e3cd89a78c29a672fda34e Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <blacklight86@gmail.com>
Date: Mon, 22 Feb 2021 14:22:39 +0100
Subject: [PATCH] Make sure to always run .quit() on the _player instance on
 stop/exit event, even if the player is already stopped, otherwise the
 OMXPlayer session may be hanging in the background and prevent new DBus
 connections

---
 platypush/plugins/media/omxplayer.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/platypush/plugins/media/omxplayer.py b/platypush/plugins/media/omxplayer.py
index 299633ae0..2ce3d82d5 100644
--- a/platypush/plugins/media/omxplayer.py
+++ b/platypush/plugins/media/omxplayer.py
@@ -117,7 +117,11 @@ class MediaOmxplayerPlugin(MediaPlugin):
 
         if self._player:
             try:
-                self._player.stop()
+                try:
+                    self._player.stop()
+                except:
+                    pass
+
                 self._player.quit()
             except OMXPlayerDeadError:
                 pass