Skip to content

Commit

Permalink
Fix mismatched channel disconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
ichorid committed Jun 1, 2021
1 parent 441a7d8 commit 72bbf49
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/tribler-gui/tribler_gui/widgets/channelcontentswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,11 @@ def empty_channels_stack(self):

def push_channels_stack(self, model):
if self.model:
self.model.info_changed.disconnect()
self.model.saved_header_state = self.controller.table_view.horizontalHeader().saveState()
self.model.saved_scroll_state = self.controller.table_view.verticalScrollBar().value()
self.controller.unset_model() # Disconnect the selectionChanged signal
self.disconnect_current_model()
self.channels_stack.append(model)
connect(self.model.info_changed, self.on_model_info_changed)

connect(self.window().core_manager.events_manager.node_info_updated, self.model.update_node_info)
self.connect_current_model()

with self.freeze_controls():
self.category_selector.setCurrentIndex(0)
Expand Down Expand Up @@ -278,8 +275,13 @@ def reset_view(self, text_filter=None):

def disconnect_current_model(self):
disconnect(self.window().core_manager.events_manager.node_info_updated, self.model.update_node_info)
disconnect(self.model.info_changed, self.on_model_info_changed)
self.controller.unset_model() # Disconnect the selectionChanged signal

def connect_current_model(self):
connect(self.model.info_changed, self.on_model_info_changed)
connect(self.window().core_manager.events_manager.node_info_updated, self.model.update_node_info)

@property
def current_level(self):
return len(self.channels_stack) - 1
Expand Down Expand Up @@ -326,7 +328,7 @@ def go_back_to_level(self, level):
self.channel_torrents_filter_input.setText(self.model.text_filter)
self.controller.set_model(self.model)

connect(self.model.info_changed, self.on_model_info_changed)
self.connect_current_model()
self.update_labels()

def on_channel_clicked(self, channel_dict):
Expand Down

0 comments on commit 72bbf49

Please sign in to comment.