Skip to content

Commit

Permalink
Fix memory leak in Downloads page
Browse files Browse the repository at this point in the history
  • Loading branch information
ichorid committed Jan 19, 2021
1 parent 12482e1 commit 62cf37e
Showing 1 changed file with 5 additions and 7 deletions.
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

0 comments on commit 62cf37e

Please sign in to comment.