From cdf93c72c172672d24bf237d374c68198813a59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Sun, 24 Nov 2024 00:41:07 +0100 Subject: [PATCH] ui: fixed delay closing the GUI When closing the GUI we were not stopping notifications channel in all cases, causing some issues (delays, log in/out problems, ...). Closes #1217 --- ui/bin/opensnitch-ui | 4 ++++ ui/opensnitch/service.py | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/bin/opensnitch-ui b/ui/bin/opensnitch-ui index 336c5bf0..3725827a 100755 --- a/ui/bin/opensnitch-ui +++ b/ui/bin/opensnitch-ui @@ -243,3 +243,7 @@ Examples: on_exit() except Exception as e: print(e) + finally: + if service: + # finish gracefully, closing notifications channel. + service.close() diff --git a/ui/opensnitch/service.py b/ui/opensnitch/service.py index 0aee9116..3acf5dd9 100644 --- a/ui/opensnitch/service.py +++ b/ui/opensnitch/service.py @@ -743,6 +743,11 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject): elif kwargs['action'] == self.NODE_DELETE: self._delete_node(kwargs['peer']) + def OpenWindow(self): + self._stats_dialog.show() + + def close(self): + self._on_close() def PostAlert(self, alert, context): proto, addr = self._get_peer(context.peer()) @@ -935,6 +940,3 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject): context.cancel() return node_iter - - def OpenWindow(self): - self._stats_dialog.show()