diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py index 9162c769b..561821527 100644 --- a/gajim/chat_control_base.py +++ b/gajim/chat_control_base.py @@ -520,8 +520,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): def shutdown(self): super(ChatControlBase, self).shutdown() # Disconnect timer callbacks - GLib.source_remove(self.possible_paused_timeout_id) - GLib.source_remove(self.possible_inactive_timeout_id) + if self.possible_paused_timeout_id: + GLib.source_remove(self.possible_paused_timeout_id) + if self.possible_inactive_timeout_id: + GLib.source_remove(self.possible_inactive_timeout_id) # PluginSystem: removing GUI extension points connected with ChatControlBase # instance object gajim.plugin_manager.remove_gui_extension_point('chat_control_base', @@ -803,6 +805,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): jid = contact.jid current_state = contact.our_chatstate if current_state is False: # jid doesn't support chatstates + self.possible_paused_timeout_id = None return False # stop looping message_buffer = self.msg_textview.get_buffer() @@ -832,6 +835,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): current_state = contact.our_chatstate if current_state is False: # jid doesn't support chatstates + self.possible_inactive_timeout_id = None return False # stop looping if self.mouse_over_in_last_5_secs or self.kbd_activity_in_last_5_secs: diff --git a/gajim/groupchat_control.py b/gajim/groupchat_control.py index 57fee08fd..a321d0def 100644 --- a/gajim/groupchat_control.py +++ b/gajim/groupchat_control.py @@ -2086,8 +2086,12 @@ class GroupchatControl(ChatControlBase): control = win.notebook.get_nth_page(ctrl_page) win.notebook.remove_page(ctrl_page) - GLib.source_remove(self.possible_paused_timeout_id) - GLib.source_remove(self.possible_inactive_timeout_id) + if self.possible_paused_timeout_id: + GLib.source_remove(self.possible_paused_timeout_id) + self.possible_paused_timeout_id = None + if self.possible_inactive_timeout_id: + GLib.source_remove(self.possible_inactive_timeout_id) + self.possible_inactive_timeout_id = None control.unparent() ctrl.parent_win = None self.send_chatstate('inactive', self.contact)