fix(print): macOS Preferences crash and color-management hardening (closes #188) #195

Merged
gronod merged 12 commits from fix/188-12 into main 2026-09-03 13:31:18 +01:00
Owner

Summary

Fixes the EXC_BAD_ACCESS crash when clicking Preferences on macOS by removing the invalid 3-argument PMSessionSetColorMatchingMode calls.

Key changes

  • All PMSessionSetColorMatchingMode* symbols now use the documented 2-argument (PMPrintSession, *const CFString) signature.
  • PMSessionSetColorMatchingModeLock sets the mode and locks the UI in one call; it does not take a Boolean.
  • Mode constants restricted to AP_ApplicationColorMatching / ApplicationColorMatching only (no ColorSync or vendor modes on profiling targets).
  • PMSessionGetCurrentPrinter pre-check preserved.
  • set_session_color_matching_mode returns bool; non-macOS stub updated.
  • Improved error logging in run_native_print_panel when the printer cannot be resolved.
  • New unit tests for color-bypass filtering and detection.
  • AGENTS.md updated with the corrected SPI notes.
  • Version bumped to 0.7.3.

Verification

  • Linux CI: passed (run #448)
  • Windows CI: passed (run #449)
  • Manual macOS test: Epson driver shows "color managed by application"; Canon driver greys out ColorSync/Canon selection (matches Photoshop behaviour).

Merge style: merge (no squash) — retain full commit history.

Closes #188.

## Summary Fixes the `EXC_BAD_ACCESS` crash when clicking **Preferences** on macOS by removing the invalid 3-argument `PMSessionSetColorMatchingMode` calls. ### Key changes - All `PMSessionSetColorMatchingMode*` symbols now use the documented 2-argument `(PMPrintSession, *const CFString)` signature. - `PMSessionSetColorMatchingModeLock` sets the mode and locks the UI in one call; it does **not** take a Boolean. - Mode constants restricted to `AP_ApplicationColorMatching` / `ApplicationColorMatching` only (no ColorSync or vendor modes on profiling targets). - `PMSessionGetCurrentPrinter` pre-check preserved. - `set_session_color_matching_mode` returns `bool`; non-macOS stub updated. - Improved error logging in `run_native_print_panel` when the printer cannot be resolved. - New unit tests for color-bypass filtering and detection. - `AGENTS.md` updated with the corrected SPI notes. - Version bumped to `0.7.3`. ### Verification - Linux CI: ✅ passed (run #448) - Windows CI: ✅ passed (run #449) - Manual macOS test: ✅ Epson driver shows "color managed by application"; Canon driver greys out ColorSync/Canon selection (matches Photoshop behaviour). **Merge style: merge (no squash)** — retain full commit history. Closes #188.
gronod added 12 commits 2026-09-03 13:31:14 +01:00
fix(print): open native NSPrintPanel for macOS printer properties (#188)
Build Windows Packages / Build Windows (push) Failing after 2m15s
Build Linux Packages / Build Linux (push) Successful in 11m2s
ce5e0ef2b5
Replace the CUPS web interface fallback with the native macOS NSPrintPanel,
pre-configured with AP_ColorMatchingMode=AP_ApplicationColorMatching so the
driver's color-management controls are greyed out (application manages color).
Capture the user's media type and quality selections from the dialog and feed
them into the lp job via PrintOptions.cups_options.

- Add objc2-app-kit / objc2-application-services dependencies for NSPrintPanel
- Rewrite show_printer_properties to dispatch NSPrintPanel on the main thread
- Always add AP_ColorMatchingMode=AP_ApplicationColorMatching in build_lp_args
- Forward captured CUPS options with deduplication against explicit fields
- Detect Epson EPIJ_Medi / EPIJ_CCor / EPIJ_OSColMat PPD options
- Add parse_cups_options_string helper and filtering of internal Apple keys
- Update frontend to store and pass captured options per printer

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
fix(print): bind macOS print panel via Core Printing, fix Windows build, and correct Epson bypass (#188)
Build Windows Packages / Build Windows (push) Failing after 2m5s
Build Linux Packages / Build Linux (push) Successful in 10m43s
313bdfdee4
fix(print): add display_name field to Windows Printer initializers
Build Windows Packages / Build Windows (push) Successful in 6m44s
Build Linux Packages / Build Linux (push) Successful in 9m19s
53d5ab20b9
fix(print): force application color matching on macOS via PM, NSPrintInfo, and lp
Build Windows Packages / Build Windows (push) Failing after 5m30s
Build Linux Packages / Build Linux (push) Successful in 10m30s
2273882330
fix(print): deref Retained<NSString> for NSPrintInfo printSettings insert
Build Windows Packages / Build Windows (push) Successful in 6m38s
Build Linux Packages / Build Linux (push) Successful in 10m7s
8f8c73d46b
fix(print): use private PMSessionSetColorMatchingMode SPI and pre-select driver color bypass
Build Windows Packages / Build Windows (push) Successful in 7m14s
Build Linux Packages / Build Linux (push) Failing after 14m28s
ff01e97ccf
fix(print): correct log::warn! string literal in color matching helper
Build Windows Packages / Build Windows (push) Failing after 9m50s
Build Linux Packages / Build Linux (push) Failing after 10m52s
7b8d9e644a
fix(print): try correct PMSessionSetColorMatchingMode signatures (3-arg, 2-arg+lock, NoLock+lock) to avoid crash
Build Windows Packages / Build Windows (push) Failing after 5m20s
Build Linux Packages / Build Linux (push) Failing after 10m55s
bafed60b20
fix(print): extended PMSessionSetColorMatchingMode signature search with mode constants, session validation, and detailed logging
Build Linux Packages / Build Linux (push) Failing after 10m59s
Build Windows Packages / Build Windows (push) Failing after 2h6m47s
3e844fdf8b
fix(print): fix PMSessionGetCurrentPrinter type with .into() and remove unused mut on printer_from_id
Build Linux Packages / Build Linux (push) Failing after 10m25s
Build Windows Packages / Build Windows (push) Failing after 2h7m9s
37b0c13263
fix(print): remove crashing 3-arg PMSessionSetColorMatchingMode calls and fix SPI usage (closes #188)
Build Windows Packages / Build Windows (push) Successful in 7m7s
Build Linux Packages / Build Linux (push) Successful in 11m4s
8b01c98463
- All PMSessionSetColorMatchingMode* symbols use the 2-arg (PMPrintSession, *const CFString) signature.
- PMSessionSetColorMatchingModeLock sets and locks in one call; it does not take a Boolean.
- Remove speculative 3-argument transmutes that caused EXC_BAD_ACCESS.
- Restrict color-matching modes to application-managed bypass only (AP_ApplicationColorMatching / ApplicationColorMatching).
- Preserve the PMSessionGetCurrentPrinter pre-check.
- Return bool from set_session_color_matching_mode and log SPI results.
- Update non-macOS stub to return bool.
- Improve run_native_print_panel error logging when the printer cannot be resolved.
- Add unit tests for color-bypass filtering and detection.
- Update AGENTS.md with the corrected SPI notes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
gronod merged commit 9a365acd2b into main 2026-09-03 13:31:18 +01:00
Sign in to join this conversation.