clean some vars when we close (group)chat windows/tabs

This commit is contained in:
Yann Leboulanger 2005-08-03 11:36:00 +00:00
parent 5ffbf2dbc0
commit 8018890427
3 changed files with 22 additions and 24 deletions

View File

@ -319,32 +319,31 @@ class Chat:
gajim.config.set('gc-width', width) gajim.config.set('gc-width', width)
gajim.config.set('gc-height', height) gajim.config.set('gc-height', height)
# FIXME: if we're here the del in 10 lines will not be called!
# maybe mem leak?
self.window.destroy() self.window.destroy()
return else:
if self.nb_unread[jid] > 0: if self.nb_unread[jid] > 0:
self.nb_unread[jid] = 0 self.nb_unread[jid] = 0
self.show_title()
if self.plugin.systray_enabled: if self.plugin.systray_enabled:
self.plugin.systray.remove_jid(jid, self.account) self.plugin.systray.remove_jid(jid, self.account)
if self.print_time_timeout_id.has_key(jid): if self.print_time_timeout_id.has_key(jid):
gobject.source_remove(self.print_time_timeout_id[jid]) gobject.source_remove(self.print_time_timeout_id[jid])
del self.print_time_timeout_id[jid] del self.print_time_timeout_id[jid]
self.notebook.remove_page(self.notebook.page_num(self.childs[jid])) self.notebook.remove_page(self.notebook.page_num(self.childs[jid]))
if len(self.xmls) == 2: if len(self.xmls) == 2:
# one that remains and one that we'll remove, 1 tab remains # one that remains and one that we'll remove, 1 tab remains
self.notebook.set_show_tabs(False) self.notebook.set_show_tabs(False)
self.show_title()
del self.plugin.windows[self.account][kind][jid] del self.plugin.windows[self.account][kind][jid]
del self.nb_unread[jid] del self.nb_unread[jid]
del gajim.last_message_time[self.account][jid] del gajim.last_message_time[self.account][jid]
del self.last_time_printout[jid] del self.last_time_printout[jid]
del self.xmls[jid] del self.xmls[jid]
del self.childs[jid]
del self.tagIn[jid] del self.tagIn[jid]
del self.tagOut[jid] del self.tagOut[jid]
del self.tagStatus[jid] del self.tagStatus[jid]
self.show_title()
def bring_scroll_to_end(self, textview, diff_y = 0): def bring_scroll_to_end(self, textview, diff_y = 0):
''' scrolls to the end of textview if end is not visible ''' ''' scrolls to the end of textview if end is not visible '''

View File

@ -309,7 +309,6 @@ class TabbedChatWindow(chat.Chat):
self.send_chatstate('gone', jid) self.send_chatstate('gone', jid)
chat.Chat.remove_tab(self, jid, 'chats') chat.Chat.remove_tab(self, jid, 'chats')
if len(self.xmls) > 0:
del self.contacts[jid] del self.contacts[jid]
def new_user(self, contact): def new_user(self, contact):