mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression that caused memory leak in Tag Browser. This would show up as the memory usage of calibre increasing when switching libraries. Fixes #9246 (Memory allocation while changing library)
This commit is contained in:
parent
f0ef93ead5
commit
46bcddc10f
@ -355,6 +355,7 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
print
|
print
|
||||||
print 'before:', self.before_mem
|
print 'before:', self.before_mem
|
||||||
print 'after:', memory()/1024**2
|
print 'after:', memory()/1024**2
|
||||||
|
print
|
||||||
self.dbref = self.before_mem = None
|
self.dbref = self.before_mem = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,6 +572,13 @@ class TagTreeItem(object): # {{{
|
|||||||
else:
|
else:
|
||||||
self.tooltip = ''
|
self.tooltip = ''
|
||||||
|
|
||||||
|
def break_cycles(self):
|
||||||
|
for x in self.children:
|
||||||
|
if hasattr(x, 'break_cycles'):
|
||||||
|
x.break_cycles()
|
||||||
|
self.parent = self.icon_state_map = self.bold_font = self.tag = \
|
||||||
|
self.icon = self.children = None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.type == self.ROOT:
|
if self.type == self.ROOT:
|
||||||
return 'ROOT'
|
return 'ROOT'
|
||||||
@ -780,6 +787,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
self.refresh(data=data)
|
self.refresh(data=data)
|
||||||
|
|
||||||
def break_cycles(self):
|
def break_cycles(self):
|
||||||
|
self.root_item.break_cycles()
|
||||||
self.db = self.root_item = None
|
self.db = self.root_item = None
|
||||||
|
|
||||||
def mimeTypes(self):
|
def mimeTypes(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user