Fix qute://version sql init bug.
Calling sql.init() in version.version() would replace the existing sql connection and cause a crash when accessed by opening qute://version. Now version relies on sql already being initted, and app.py inits sql early if the --version arg is given.
This commit is contained in:
parent
231bbe7c2b
commit
a8ed9f1c2f
@ -83,6 +83,9 @@ def run(args):
|
|||||||
standarddir.init(args)
|
standarddir.init(args)
|
||||||
|
|
||||||
if args.version:
|
if args.version:
|
||||||
|
# we need to init sql to print the sql version
|
||||||
|
# we can use an in-memory database as we just want to query the version
|
||||||
|
sql.init('')
|
||||||
print(version.version())
|
print(version.version())
|
||||||
sys.exit(usertypes.Exit.ok)
|
sys.exit(usertypes.Exit.ok)
|
||||||
|
|
||||||
|
@ -326,11 +326,7 @@ def version():
|
|||||||
lines += _module_versions()
|
lines += _module_versions()
|
||||||
|
|
||||||
lines += ['pdf.js: {}'.format(_pdfjs_version())]
|
lines += ['pdf.js: {}'.format(_pdfjs_version())]
|
||||||
|
|
||||||
# we can use an in-memory database as we just want to query the version
|
|
||||||
sql.init('')
|
|
||||||
lines += ['sqlite: {}'.format(sql.version())]
|
lines += ['sqlite: {}'.format(sql.version())]
|
||||||
sql.close()
|
|
||||||
|
|
||||||
lines += [
|
lines += [
|
||||||
'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
|
'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
|
||||||
|
@ -702,3 +702,11 @@ Feature: Various utility commands.
|
|||||||
And I wait for "Renderer process was killed" in the log
|
And I wait for "Renderer process was killed" in the log
|
||||||
And I open data/numbers/3.txt
|
And I open data/numbers/3.txt
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
And the following tabs should be open:
|
||||||
|
- data/numbers/3.txt (active)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
Scenario: Open qute://version
|
||||||
|
When I open qute://version
|
||||||
|
Then the page should contain the plaintext "Version info"
|
||||||
|
@ -809,7 +809,7 @@ def test_chromium_version_unpatched(qapp):
|
|||||||
(True, False, True, True, False), # unknown Linux distribution
|
(True, False, True, True, False), # unknown Linux distribution
|
||||||
])
|
])
|
||||||
def test_version_output(git_commit, frozen, style, with_webkit,
|
def test_version_output(git_commit, frozen, style, with_webkit,
|
||||||
known_distribution, stubs, monkeypatch):
|
known_distribution, stubs, monkeypatch, init_sql):
|
||||||
"""Test version.version()."""
|
"""Test version.version()."""
|
||||||
class FakeWebEngineProfile:
|
class FakeWebEngineProfile:
|
||||||
def httpUserAgent(self):
|
def httpUserAgent(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user