Repository navigation
v0.5.6 — PDF export no longer crashes
Fixed
-
PDF export no longer crashes. Two separate crashes, both on the export path, both fixed.
The first killed the app from a background thread. AppKit runs WKWebView's print operation on a thread it spawns itself, so the completion callback arrived off the main thread — and the export teardown it triggered calls WebKit APIs that are main-thread-only. WebKit answers an off-main call by killing the process outright. This fired on every PDF export at default settings, because the default PDF font scale of 85% puts a stylesheet-removal step on the teardown path. Latent since 0.4.8; it surfaced on macOS 27.
The second trapped whenever the preview pane had never been shown in that window. Source-only layout collapses the preview, and macOS never builds the view of a collapsed pane — so the web view the export needs did not exist yet. Exporting from Source-only layout trapped every time, whatever your export settings.
Export now brings the preview up on demand, waits for it to finish rendering, and prints from it. Source-only and Split produce identical PDFs, and the window does not visibly change while it happens.
-
A failed export now tells you. Several paths could leave you with a blank PDF, or no file at all, while the status bar still said "Exported". Those now report failure. In particular, exporting while Writ was in the background could silently produce a blank document — WebKit will not draw for a window the system considers hidden, so Writ now brings the document window forward before printing.
-
Two exports at once no longer clobber each other. Triggering a second export while one was running produced two blank files and could crash the app. The second is now refused with "PDF export already running".
Known limitation
Very large documents (multi-megabyte) can still export blank on the first export from a never-shown preview; exporting again immediately gives the correct file. The preview reports that it has rendered before WebKit has finished laying out a DOM that size. Normal-sized documents are unaffected. Fixing it properly needs a real layout-quiesced signal and is tracked for a follow-up.
Under the hood
The project gained its first app-level test target (WritTests, 10 tests). It is deliberately hostless — a test host would launch a document window and a WKWebView on every run.
Download: Writ-0.5.6.dmg (6.0 MB, notarized + stapled)