From 61b76b3e4cdcff1a865e44676409045c6cb5a472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Wed, 3 May 2017 18:35:17 +0200
Subject: [PATCH] Fix to prevent updater from crashing
---
dnfdragora/ui.py | 11 +++++++----
dnfdragora/updater.py | 4 ++--
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dnfdragora/ui.py b/dnfdragora/ui.py
index 0060f38..b560320 100644
--- a/dnfdragora/ui.py
+++ b/dnfdragora/ui.py
@@ -131,6 +131,8 @@ def __init__(self, options={}):
constructor
'''
+ self.running = True
+ self.loop_has_finished = False
self.options = options
self._progressBar = None
self.packageQueue = PackageQueue()
@@ -1069,7 +1071,7 @@ def handleevent(self):
"""
Event-handler for the maindialog
"""
- while True:
+ while self.running == True:
event = self.dialog.waitForEvent()
@@ -1235,8 +1237,9 @@ def handleevent(self):
# Save user prefs on exit
self.saveUserPreference()
+ self.loop_has_finished = True
self.dialog.destroy()
+ self.backend.Unlock()
- # next line seems to be a workaround to prevent the qt-app from crashing
- # see https://github.com/libyui/libyui-qt/issues/41
- yui.YUILoader.deleteUI()
+ def quit():
+ self.running = False
diff --git a/dnfdragora/updater.py b/dnfdragora/updater.py
index a46d7dd..fca8f41 100644
--- a/dnfdragora/updater.py
+++ b/dnfdragora/updater.py
@@ -56,8 +56,8 @@ def __shutdown(self, *kwargs):
try:
self.__running = False
self.__updater.join()
- self.__main_gui.running = False
- while self.__main_gui.has_finished != True:
+ self.__main_gui.quit()
+ while self.__main_gui.loop_has_finished != True:
time.sleep(1)
self.__main_gui.backend.quit()
yui.YDialog.deleteAllDialogs()