Bug #2616: Memory leaks

svn: r12397
This commit is contained in:
Gary Burton 2009-03-31 20:45:20 +00:00
parent cf35428179
commit 1b2135f49c
3 changed files with 65 additions and 39 deletions

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -171,25 +171,35 @@ class EditMedia(EditPrimary):
def _create_tabbed_pages(self): def _create_tabbed_pages(self):
notebook = gtk.Notebook() notebook = gtk.Notebook()
self.src_list = self._add_tab( self.src_tab = SourceEmbedList(self.dbstate,
notebook, self.uistate,
SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)) self.track,
self.obj)
self._add_tab(notebook, self.src_tab)
self.track_ref_for_deletion("src_tab")
self.attr_list = self._add_tab( self.attr_tab = AttrEmbedList(self.dbstate,
notebook, self.uistate,
AttrEmbedList(self.dbstate, self.uistate, self.track, self.track,
self.obj.get_attribute_list())) self.obj.get_attribute_list())
self._add_tab(notebook, self.attr_tab)
self.track_ref_for_deletion("attr_tab")
self.note_tab = self._add_tab( self.note_tab = NoteTab(self.dbstate,
notebook, self.uistate,
NoteTab(self.dbstate, self.uistate, self.track, self.track,
self.obj.get_note_list(), self.obj.get_note_list(),
notetype=gen.lib.NoteType.MEDIA)) notetype=gen.lib.NoteType.MEDIA)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
self.backref_list = self._add_tab( self.backref_tab = MediaBackRefList(self.dbstate,
notebook, self.uistate,
MediaBackRefList(self.dbstate,self.uistate,self.track, self.track,
self.db.find_backlink_handles(self.obj.handle))) self.db.find_backlink_handles(self.obj.handle))
self.backref_list = self._add_tab(notebook, self.backref_tab)
self.track_ref_for_deletion("backref_tab")
self.track_ref_for_deletion("backref_list")
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()

View File

@ -178,6 +178,7 @@ class EditNote(EditPrimary):
notebook.remove_page(0) notebook.remove_page(0)
self.ntab = NoteTab(self.dbstate, self.uistate, self.track, self.ntab = NoteTab(self.dbstate, self.uistate, self.track,
_('_Note'), vboxnote) _('_Note'), vboxnote)
self.track_ref_for_deletion("ntab")
self.build_interface() self.build_interface()
@ -232,8 +233,13 @@ class EditNote(EditPrimary):
self._add_tab(notebook, self.ntab) self._add_tab(notebook, self.ntab)
handles = self.dbstate.db.find_backlink_handles(self.obj.handle) handles = self.dbstate.db.find_backlink_handles(self.obj.handle)
rlist = NoteBackRefList(self.dbstate, self.uistate, self.track, handles) self.rlist = NoteBackRefList(self.dbstate,
self.backref_tab = self._add_tab(notebook, rlist) self.uistate,
self.track,
handles)
self.backref_tab = self._add_tab(notebook, self.rlist)
self.track_ref_for_deletion("rlist")
self.track_ref_for_deletion("backref_tab")
self._setup_notebook_tabs(notebook) self._setup_notebook_tabs(notebook)

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -107,28 +107,38 @@ class EditRepository(EditPrimary):
notebook = gtk.Notebook() notebook = gtk.Notebook()
self.addr_tab = self._add_tab( self.addr_tab = AddrEmbedList(self.dbstate,
notebook, self.uistate,
AddrEmbedList(self.dbstate, self.uistate, self.track, self.track,
self.obj.get_address_list())) self.obj.get_address_list())
self._add_tab(notebook, self.addr_tab)
self.track_ref_for_deletion("addr_tab")
self.url_tab = self._add_tab( self.url_tab = WebEmbedList(self.dbstate,
notebook, self.uistate,
WebEmbedList(self.dbstate, self.uistate, self.track, self.track,
self.obj.get_url_list())) self.obj.get_url_list())
self._add_tab(notebook, self.url_tab)
self.track_ref_for_deletion("url_tab")
self.note_tab = self._add_tab( self.note_tab = NoteTab(self.dbstate,
notebook, self.uistate,
NoteTab(self.dbstate, self.uistate, self.track, self.track,
self.obj.get_note_list(), self.get_menu_title(), self.obj.get_note_list(),
notetype=gen.lib.NoteType.REPO)) self.get_menu_title(),
notetype=gen.lib.NoteType.REPO)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
self.backref_tab = self._add_tab( self.backref_tab = SourceBackRefList(self.dbstate,
notebook, self.uistate,
SourceBackRefList(self.dbstate, self.uistate, self.track, self.track,
self.db.find_backlink_handles(self.obj.handle))) self.db.find_backlink_handles(self.obj.handle))
self.backref_list = self._add_tab(notebook, self.backref_tab)
self.track_ref_for_deletion("backref_tab")
self.track_ref_for_deletion("backref_list")
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs(notebook)
notebook.show_all() notebook.show_all()
self.glade.get_widget("vbox").pack_start(notebook, True, True) self.glade.get_widget("vbox").pack_start(notebook, True, True)
@ -174,7 +184,7 @@ class EditRepository(EditPrimary):
self.close() self.close()
def _cleanup_on_exit(self): def _cleanup_on_exit(self):
self.backref_tab.close() self.backref_list.close()
class DelRepositoryQuery: class DelRepositoryQuery:
def __init__(self, dbstate, uistate, repository, sources): def __init__(self, dbstate, uistate, repository, sources):