diff options
author | toofar <toofar@spalge.com> | 2023-10-28 15:58:09 +1300 |
---|---|---|
committer | toofar <toofar@spalge.com> | 2023-10-28 15:58:09 +1300 |
commit | 931b65330136f5400a021f07d73e9f38381db669 (patch) | |
tree | ca1acf139e832621a8f7d8f8d0905f84b59d2c6e | |
parent | 3bde102fe0a317dc97b459da7cfeaffc1c439932 (diff) | |
download | qutebrowser-931b65330136f5400a021f07d73e9f38381db669.tar.gz qutebrowser-931b65330136f5400a021f07d73e9f38381db669.zip |
move resources patching later
We need to set the environment variable before webengine reads the
resources file. It could be unhelpful to do the patching before the IPC
/ open-in-existing-instance stuff, because that could lead to removing
the resources file the running instance is using, any later than that is
just down to developer preference I think. I chose to move it as late as
possible for now, just for clarity on where in the lifecycle it's
necessary. (This also means we can skip the separate backend check, but
that is pretty minor.)
I moved the patching later and later at init and verified that if it is
done before the profiles are initialized it successfully prevents the
crash. If done after the profiles are initialized we still crash. I do
remember looking at the profile initialization when trying to disable
extensions so that makes sense.
-rw-r--r-- | qutebrowser/app.py | 6 | ||||
-rw-r--r-- | qutebrowser/browser/webengine/webenginesettings.py | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 4a6284eb1..778c248c2 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -50,7 +50,7 @@ from qutebrowser.keyinput import macros, eventfilter from qutebrowser.mainwindow import mainwindow, prompt, windowundo from qutebrowser.misc import (ipc, savemanager, sessions, crashsignal, earlyinit, sql, cmdhistory, backendproblem, - objects, quitter, nativeeventfilter, pakjoy) + objects, quitter, nativeeventfilter) from qutebrowser.utils import (log, version, message, utils, urlutils, objreg, resources, usertypes, standarddir, error, qtutils, debug) @@ -76,10 +76,6 @@ def run(args): log.init.debug("Initializing config...") configinit.early_init(args) - # Run after we've imported Qt but before webengine is initialized. - # TODO: check: backend, Qt version, frozen - pakjoy.patch() - log.init.debug("Initializing application...") app = Application(args) objects.qapp = app diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index d0b6b5beb..168fb8280 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -24,6 +24,7 @@ from qutebrowser.browser.webengine import (spell, webenginequtescheme, cookies, webenginedownloads, notification) from qutebrowser.config import config, websettings from qutebrowser.config.websettings import AttributeInfo as Attr +from qutebrowser.misc import pakjoy from qutebrowser.utils import (standarddir, qtutils, message, log, urlmatch, usertypes, objreg, version) if TYPE_CHECKING: @@ -546,6 +547,10 @@ def init(): _global_settings = WebEngineSettings(_SettingsWrapper()) log.init.debug("Initializing profiles...") + + # Apply potential resource patches before initializing profiles. + pakjoy.patch() + _init_default_profile() init_private_profile() config.instance.changed.connect(_update_settings) |