From 04409bfb9063d9324b59a5bf45913737c0f309fa Mon Sep 17 00:00:00 2001 From: "V.G. Bulavintsev" Date: Tue, 19 Jan 2021 17:21:50 +0100 Subject: [PATCH] Fix memory leak in Downloads page --- src/tribler-gui/tribler_gui/widgets/downloadspage.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/tribler-gui/tribler_gui/widgets/downloadspage.py b/src/tribler-gui/tribler_gui/widgets/downloadspage.py index 3fe8f57ace3..c35ad58eb44 100644 --- a/src/tribler-gui/tribler_gui/widgets/downloadspage.py +++ b/src/tribler-gui/tribler_gui/widgets/downloadspage.py @@ -96,6 +96,11 @@ def initialize_downloads_page(self): self.window().downloads_list.header().setSortIndicator(12, Qt.AscendingOrder) self.window().downloads_list.header().resizeSection(12, 146) + self.downloads_timeout_timer.setSingleShot(True) + self.downloads_timer.setSingleShot(True) + connect(self.downloads_timer.timeout, self.load_downloads) + connect(self.downloads_timeout_timer.timeout, self.on_downloads_request_timeout) + def on_filter_text_changed(self, text): self.window().downloads_list.clearSelection() self.window().download_details_widget.hide() @@ -111,14 +116,7 @@ def start_loading_downloads(self): self.schedule_downloads_timer(now=True) def schedule_downloads_timer(self, now=False): - self.downloads_timer = QTimer() - self.downloads_timer.setSingleShot(True) - connect(self.downloads_timer.timeout, self.load_downloads) self.downloads_timer.start(0 if now else 1000) - - self.downloads_timeout_timer = QTimer() - self.downloads_timeout_timer.setSingleShot(True) - connect(self.downloads_timeout_timer.timeout, self.on_downloads_request_timeout) self.downloads_timeout_timer.start(16000) def on_downloads_request_timeout(self):