mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix memory leak when using the Convert Single book dialog
This commit is contained in:
parent
c41d948498
commit
134c37c4b8
@ -191,6 +191,8 @@ def main(args=sys.argv):
|
||||
exec opts.command
|
||||
elif opts.exec_file:
|
||||
sys.argv = args[:1]
|
||||
base = os.path.dirname(os.path.abspath(opts.exec_file))
|
||||
sys.path.insert(0, base)
|
||||
execfile(opts.exec_file)
|
||||
elif opts.debug_device_driver:
|
||||
debug_device_driver()
|
||||
|
@ -164,6 +164,9 @@ class Widget(QWidget):
|
||||
def post_get_value(self, g):
|
||||
pass
|
||||
|
||||
def break_cycles(self):
|
||||
self.db = None
|
||||
|
||||
def pre_commit_check(self):
|
||||
return True
|
||||
|
||||
|
@ -115,7 +115,6 @@ class Config(ResizableDialog, Ui_Dialog):
|
||||
def __init__(self, parent, db, book_id,
|
||||
preferred_input_format=None, preferred_output_format=None):
|
||||
ResizableDialog.__init__(self, parent)
|
||||
|
||||
self.setup_input_output_formats(db, book_id, preferred_input_format,
|
||||
preferred_output_format)
|
||||
self.db, self.book_id = db, book_id
|
||||
@ -248,8 +247,18 @@ class Config(ResizableDialog, Ui_Dialog):
|
||||
if self.db is not None:
|
||||
recs['gui_preferred_input_format'] = self.input_format
|
||||
save_specifics(self.db, self.book_id, recs)
|
||||
self.break_cycles()
|
||||
ResizableDialog.accept(self)
|
||||
|
||||
def reject(self):
|
||||
self.break_cycles()
|
||||
ResizableDialog.reject(self)
|
||||
|
||||
def break_cycles(self):
|
||||
for i in range(self.stack.count()):
|
||||
w = self.stack.widget(i)
|
||||
w.break_cycles()
|
||||
|
||||
@property
|
||||
def recommendations(self):
|
||||
recs = [(k, v, OptionRecommendation.HIGH) for k, v in
|
||||
|
@ -41,6 +41,11 @@ class StructureDetectionWidget(Widget, Ui_Form):
|
||||
self.opt_footer_regex.set_book_id(book_id)
|
||||
self.opt_footer_regex.set_db(db)
|
||||
|
||||
def break_cycles(self):
|
||||
Widget.break_cycles(self)
|
||||
self.opt_header_regex.db = None
|
||||
self.opt_footer_regex.db = None
|
||||
|
||||
def pre_commit_check(self):
|
||||
for x in ('header_regex', 'footer_regex'):
|
||||
x = getattr(self, 'opt_'+x)
|
||||
|
@ -77,6 +77,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, out_format
|
||||
jobs.append(('gui_convert', args, desc, d.output_format.upper(), book_id, temp_files))
|
||||
|
||||
changed = True
|
||||
d.break_cycles()
|
||||
except NoSupportedInputFormats:
|
||||
bad.append(book_id)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user