Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os as _os
DESKTOP = _os.path.join(_os.path.expanduser("~"), "Desktop")

APP_VERSION = "1.13.10"
APP_VERSION = "1.13.11"
GITHUB_REPO = "nelsonduarte/PDFApps"

ACCENT = "#14B8A6" # main teal
Expand Down
19 changes: 13 additions & 6 deletions app/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,17 +948,24 @@ def _restart_app(self):
program = sys.executable
args = [script] + pdf_args
cwd = os.path.dirname(script) or os.getcwd()
# PyInstaller --onefile points _PYI_APPLICATION_HOME_DIR (or the
# legacy _MEIPASS2) at our temp extraction folder. The parent
# deletes that folder on exit, so the child must perform its
# own extraction instead of reusing ours.
# PyInstaller --onefile uses several env vars to coordinate the
# two-phase bootloader handoff: _PYI_APPLICATION_HOME_DIR (the
# extracted temp path), _PYI_PARENT_PROCESS_LEVEL (phase marker)
# and _PYI_ARCHIVE_FILE, plus the legacy _MEIPASS2. The parent
# deletes its temp folder on exit, so the child must perform its
# own extraction instead of reusing ours. We must clear ALL of
# these — leaving any one set makes the child's bootloader think
# it's a child-phase launch and either reuse the about-to-be-
# deleted folder or, if some vars are missing, abort with
# "_PYI_APPLICATION_HOME_DIR environment variable is not defined!".
proc = QProcess()
proc.setProgram(program)
proc.setArguments(args)
proc.setWorkingDirectory(cwd)
env = QProcessEnvironment.systemEnvironment()
env.remove("_PYI_APPLICATION_HOME_DIR")
env.remove("_MEIPASS2")
for _k in list(env.keys()):
if _k.startswith("_PYI_") or _k.startswith("_MEIPASS"):
env.remove(_k)
proc.setProcessEnvironment(env)
proc.startDetached()
QApplication.instance().exit(0)
Expand Down