mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
05be08a9ee
commit
80bb000575
@ -390,7 +390,7 @@ class ChooseLibraryAction(InterfaceAction):
|
||||
#self.dbref = weakref.ref(self.gui.library_view.model().db)
|
||||
#self.before_mem = memory()/1024**2
|
||||
self.gui.library_moved(loc)
|
||||
#QTimer.singleShot(1000, self.debug_leak)
|
||||
#QTimer.singleShot(5000, self.debug_leak)
|
||||
|
||||
def debug_leak(self):
|
||||
import gc
|
||||
@ -398,7 +398,7 @@ class ChooseLibraryAction(InterfaceAction):
|
||||
ref = self.dbref
|
||||
for i in xrange(3): gc.collect()
|
||||
if ref() is not None:
|
||||
print 11111, ref()
|
||||
print 'DB object alive:', ref()
|
||||
for r in gc.get_referrers(ref())[:10]:
|
||||
print r
|
||||
print
|
||||
|
@ -727,7 +727,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
for user_cat in sorted(self.db.prefs.get('user_categories', {}).keys(),
|
||||
key=sort_key):
|
||||
cat_name = '@' + user_cat # add the '@' to avoid name collision
|
||||
tb_cats.add_user_category(label=cat_name, name=user_cat)
|
||||
try:
|
||||
tb_cats.add_user_category(label=cat_name, name=user_cat)
|
||||
except ValueError:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
if len(saved_searches().names()):
|
||||
tb_cats.add_search_category(label='search', name=_('Searches'))
|
||||
|
||||
|
@ -42,7 +42,8 @@ class MetadataBackup(Thread): # {{{
|
||||
|
||||
def stop(self):
|
||||
self.keep_running = False
|
||||
self.flush()
|
||||
|
||||
def break_cycles(self):
|
||||
# Break cycles so that this object doesn't hold references to db
|
||||
self.do_write = self.get_metadata_for_dump = self.clear_dirtied = \
|
||||
self.set_dirtied = self.db = None
|
||||
@ -111,6 +112,8 @@ class MetadataBackup(Thread): # {{{
|
||||
continue
|
||||
|
||||
self.in_limbo = None
|
||||
self.flush()
|
||||
self.break_cycles()
|
||||
|
||||
def flush(self):
|
||||
'Used during shutdown to ensure that a dirtied book is not missed'
|
||||
|
Loading…
x
Reference in New Issue
Block a user