Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak in Downloads page #5949

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/tribler-gui/tribler_gui/widgets/downloadspage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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):
Expand Down