Fix Linux startup crash caused by the update notification dialog - #2791
Conversation
On Linux (wxGTK), wx.html2.WebView is backed by WebKitGTK. In the AppImage the bundled Ubuntu build of WebKitGTK fails to spawn its helper processes on other distributions, which aborts the whole application a few seconds after startup (issue pyfa-org#2740). On distributions without webkit2gtk-4.0, even importing wx.html2 fails, which breaks startup from source as well. Never use the WebView on wxGTK and fall back to a plain text release notes widget there. On other platforms guard the WebView creation and fall back to plain text when no backend is available. Also guard ShowUpdateBox so a dialog failure can no longer take down startup, default empty release notes bodies to an empty string and put the release tag in the dialog title instead of a literal '{}'. Behavior on Windows and macOS is unchanged.
The update dialog no longer uses wx.html2.WebView on Linux, so nothing in the AppImage loads libwebkit2gtk-4.0-37 anymore and it can be dropped from the bundle.
|
Don't do anything re dark mode (and pretty much anything else) for now. wxpython 4.3 was released 2 days ago, it will likely bring it automatically (it is backed by wxwidgets v3.3.x which should have that functionality on windows). I will work on uplifting pyfa's dependencies / python over this weekend and next week. It will result in lots of changes, likely making you to redo your work. Will check this PR and merge if everything is fine later today. |
|
I just checked it. Looks good, thanks. |
sure thing. I'll check next week if there is something else i might be able to pick up. |
Hi! I love pyfa - I've been using it for years. I'm primarily on Linux these days, and it would crash on startup, so I decided to fix that and give some love back to the project. More to follow if you're happy with my work (I was thinking about the dark mode request, but then again, on Linux it's already sort of there, so I'd need to switch machines... eh, we'll see).
What / why
Addresses #2740 - the Linux AppImage dies ~2-3 s after launch with nothing in the Python log.
Root cause
The update notification dialog (
gui/updateDialog.py) is the only user ofwx.html2.WebView. On wxGTK that's WebKitGTK, and:AppImage: the builder bundles jammy's
libwebkit2gtk-4.0-37. The library loads, but WebKit then tries to spawn its helper processes at the Ubuntu-hardcoded path/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess, which doesn't exist on other distros - a fatal GLib error that aborts the app with no Python traceback. This is why it "appeared" with 2.66.2:git diff v2.66.1..v2.66.3touched nothing in the startup/update path - 2.66.2 was simply the first release new enough for the popup to run at all. Reproduced on Fedora 44 with the v2.64.2 AppImage (exit 133 = SIGTRAP):In
~/.pyfa/pyfa.log, every crashed launch ends exactly atservice.update: Starting Check Update Thread.From source on distros without webkit2gtk-4.0 (Fedora today):
import wx.html2itself fails, so startup dies before the main window -gui/mainFrame.pyimports the dialog at module level.Changes
gui/updateDialog.py: never use the WebView on wxGTK (a native abort can't be caught with try/except) - release notes render in a read-onlywx.TextCtrlinstead; the Download button already opens the release page in a browser. Other platforms keep the WebView but checkIsBackendAvailable()and guardWebView.New()/SetPage(), falling back to plain text on failure.import wx.html2is now lazy so startup doesn't depend on WebKitGTK being present. Two small guards while there:releaseInfo['body']may beNone(wouldTypeError), and the dialog title contained a literal{}- it now shows the release tag.gui/mainFrame.py:ShowUpdateBoxwrapped in try/except + logging so a dialog failure can never silently break startup again.dist_assets/linux/AppImageBuilder.yml: droplibwebkit2gtk-4.0-37- nothing loads it on Linux anymore. Happy to split this into a separate PR if preferred.Behavior on Windows/macOS is unchanged (WebView2/WKWebView still used, now guarded).
Verified
import wx.html2, both on Fedora 44.version.ymlto force the popup - app survives, dialog opens with plain-text notes; headlessUpdateDialogconstruction against live release data passes; flake8 (tox pep8 flags) adds zero findings on changed files.Notes
Flagging so that you know:
service/update.pyswallows the primary endpoint's error silently (lines 54-59) and assumes the response is a JSON list (line 61) - might be worth fixing later?