mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix regression that caused the ebook viewer to stop functioning if it is launched from the main calibre program and then the main calibre program is closed. Fixes #963960 (Reader crashes at end of chapter)
This commit is contained in:
parent
4b4ae70290
commit
5a1307ca6f
@ -27,6 +27,7 @@ from calibre.ebooks.metadata import MetaInformation
|
|||||||
from calibre.customize.ui import available_input_formats
|
from calibre.customize.ui import available_input_formats
|
||||||
from calibre.gui2.viewer.dictionary import Lookup
|
from calibre.gui2.viewer.dictionary import Lookup
|
||||||
from calibre import as_unicode, force_unicode, isbytestring
|
from calibre import as_unicode, force_unicode, isbytestring
|
||||||
|
from calibre.ptempfile import reset_base_dir
|
||||||
|
|
||||||
vprefs = JSONConfig('viewer')
|
vprefs = JSONConfig('viewer')
|
||||||
|
|
||||||
@ -947,6 +948,7 @@ View an ebook.
|
|||||||
def main(args=sys.argv):
|
def main(args=sys.argv):
|
||||||
# Ensure viewer can continue to function if GUI is closed
|
# Ensure viewer can continue to function if GUI is closed
|
||||||
os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
|
os.environ.pop('CALIBRE_WORKER_TEMP_DIR', None)
|
||||||
|
reset_base_dir()
|
||||||
|
|
||||||
parser = option_parser()
|
parser = option_parser()
|
||||||
opts, args = parser.parse_args(args)
|
opts, args = parser.parse_args(args)
|
||||||
|
@ -74,6 +74,11 @@ def base_dir():
|
|||||||
|
|
||||||
return _base_dir
|
return _base_dir
|
||||||
|
|
||||||
|
def reset_base_dir():
|
||||||
|
global _base_dir
|
||||||
|
_base_dir = None
|
||||||
|
base_dir()
|
||||||
|
|
||||||
def force_unicode(x):
|
def force_unicode(x):
|
||||||
# Cannot use the implementation in calibre.__init__ as it causes a circular
|
# Cannot use the implementation in calibre.__init__ as it causes a circular
|
||||||
# dependency
|
# dependency
|
||||||
|
Loading…
x
Reference in New Issue
Block a user