Philipp Hörist pushed to branch mainwindow at gajim / gajim
Commits: 5270bad4 by lovetox at 2021-03-07T11:12:15+01:00 Fix leaving muc
- - - - - 30b27cdd by lovetox at 2021-03-07T11:21:37+01:00 Add more leak checks
- - - - -
7 changed files:
- gajim/chat_control.py - gajim/common/helpers.py - gajim/common/modules/chatstates.py - gajim/groupchat_control.py - gajim/gtk/chat_list_stack.py - gajim/gui_interface.py - gajim/gui_menu_builder.py
Changes:
===================================== gajim/chat_control.py ===================================== @@ -1106,6 +1106,7 @@ def shutdown(self): # Remove contact instance if contact has been removed
super(ChatControl, self).shutdown() + app.check_finalize(self)
def minimizable(self): return False
===================================== gajim/common/helpers.py ===================================== @@ -1299,14 +1299,14 @@ def disconnect(self, object_): for qualifier, handlers in qualifiers.items(): for handler in list(handlers): func = handler() - if func is None or func.__self__ == object_: + if func is None or func.__self__ is object_: self._callbacks[signal_name][qualifier].remove(handler)
def connect(self, signal_name, func, qualifiers=None): - if inspect.ismethod(func): - weak_func = weakref.WeakMethod(func) - elif inspect.isfunction(func): - weak_func = weakref.ref(func) + if not inspect.ismethod(func): + raise ValueError('Only bound methods allowed') + + weak_func = weakref.WeakMethod(func)
self._callbacks[signal_name][qualifiers].append(weak_func)
===================================== gajim/common/modules/chatstates.py ===================================== @@ -120,8 +120,9 @@ def _presence_received(self, self._log.info('Reset chatstate for %s', jid)
contact = self._get_contact(jid) - if contact is None: + if contact.is_groupchat: return + contact.notify('chatstate-update')
def _process_chatstate(self, _con, _stanza, properties):
===================================== gajim/groupchat_control.py ===================================== @@ -307,7 +307,6 @@ def add_actions(self): ('rename-groupchat-', None, self._on_rename_groupchat), ('change-subject-', None, self._on_change_subject), ('change-nickname-', None, self._on_change_nick), - ('disconnect-', None, self._on_disconnect), ('destroy-', None, self._on_destroy_room), ('configure-', None, self._on_configure_room), ('request-voice-', None, self._on_request_voice), @@ -476,9 +475,6 @@ def _on_muc_disco_update(self, _event): self.draw_banner_text()
# Actions - def _on_disconnect(self, _action, _param): - self.leave() - def _on_information(self, _action, _param): self._muc_info_box.set_from_disco_info(self.disco_info) if self._subject_data is not None: @@ -1006,12 +1002,6 @@ def got_disconnected(self):
self.update_actions()
- def leave(self, reason=None): - self.got_disconnected() - self._close_control(reason=reason) - app.connections[self.account].get_module('MUC').leave( - self.room_jid, reason=reason) - def rejoin(self): app.connections[self.account].get_module('MUC').join(self._muc_data)
@@ -1390,6 +1380,8 @@ def shutdown(self, reason=None): app.settings.disconnect_signals(self) self.contact.disconnect(self)
+ client = app.get_client(self.account) + client.get_module('MUC').get_manager().disconnect(self) # PluginSystem: removing GUI extension points connected with # GrouphatControl instance object app.plugin_manager.remove_gui_extension_point( @@ -1411,6 +1403,7 @@ def shutdown(self, reason=None): self.remove_actions()
super(GroupchatControl, self).shutdown() + app.check_finalize(self)
def safe_shutdown(self): # whether to ask for confirmation before closing muc
===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -100,7 +100,7 @@ def add_chat_list(self, workspace_id): def remove_chat_list(self, workspace_id): chat_list = self._chat_lists[workspace_id] self.remove(chat_list) - for account, jid, _ in chat_list.get_open_chats(): + for account, jid, _, _ in chat_list.get_open_chats(): self.remove_chat(workspace_id, account, jid)
self._chat_lists.pop(workspace_id)
===================================== gajim/gui_interface.py ===================================== @@ -1363,8 +1363,7 @@ def show_add_join_groupchat(self, account, jid, nickname=None):
app.window.add_group_chat(account, str(jid), select=True)
- @staticmethod - def _on_muc_added(_muc_manger, _signal_name, account, jid): + def _on_muc_added(self, _muc_manger, _signal_name, account, jid): if app.window.chat_exists(account, jid): return
===================================== gajim/gui_menu_builder.py ===================================== @@ -586,7 +586,6 @@ def get_groupchat_menu(control_id, account, jid): ('win.request-voice-', _('Request Voice')), ('win.execute-command-', _('Execute Command…')), ('app.browse-history', _('History')), - ('win.disconnect-', _('Leave')), ]
def build_menu(preset):
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/7e2351d29fa2cb8809f0713973efac03...