You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/08/22 05:05:10 UTC

(maka) branch main updated: fix(desktop): never request the 'large' file icon that kills packaged macOS builds (#3455)

This is an automated email from the ASF dual-hosted git repository.

M4n5ter pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/main by this push:
     new 9850304f1 fix(desktop): never request the 'large' file icon that kills packaged macOS builds (#3455)
9850304f1 is described below

commit 9850304f16c5812c0beccd8c561da7470ef1d69e
Author: UDY4M <72...@users.noreply.github.com>
AuthorDate: Sat Aug 22 13:05:06 2026 +0800

    fix(desktop): never request the 'large' file icon that kills packaged macOS builds (#3455)
    
    app.getFileIcon(path, { size: 'large' }) is unsupported on macOS and hits
    a fatal NOTREACHED inside Chromium's IconLoader — the process dies with
    SIGTRAP before the promise settles, so loadNativeBundleIcon's try/catch
    never runs. Packaged builds crashed the moment the drag-to-grant
    permission guide loaded the app icon; dev builds were spared only by the
    isPackaged gate from #1920.
    
    Hoist the size choice into one shared BUNDLE_ICON_OPTIONS constant
    requesting 'normal' (32x32, supported everywhere), which the existing
    resize step upscales to the same 64x64 the code already produced.
    
    Fixes #3352
    
    Generated-by: Claude Code
---
 .../src/main/__tests__/permission-overlay-controller.test.ts     | 7 +++++++
 apps/desktop/src/main/permission-overlay/app-bundle.ts           | 9 +++++++++
 .../src/main/permission-overlay/permission-overlay-main.ts       | 6 +++---
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/apps/desktop/src/main/__tests__/permission-overlay-controller.test.ts b/apps/desktop/src/main/__tests__/permission-overlay-controller.test.ts
index 5450db4f3..aa43c203d 100644
--- a/apps/desktop/src/main/__tests__/permission-overlay-controller.test.ts
+++ b/apps/desktop/src/main/__tests__/permission-overlay-controller.test.ts
@@ -21,6 +21,7 @@ import {
   type PermissionOverlayWindowLike,
 } from '../permission-overlay/permission-overlay-controller.js';
 import {
+  BUNDLE_ICON_OPTIONS,
   loadNativeBundleIcon,
   resolveAppBundle,
 } from '../permission-overlay/app-bundle.js';
@@ -317,6 +318,12 @@ describe('app bundle resolution for the drag', () => {
     assert.equal(await loadNativeBundleIcon(true, async () => 'icon'), 'icon');
   });
 
+  it('never requests the large icon size that kills packaged macOS builds', () => {
+    // 'large' hits a fatal NOTREACHED inside Chromium's IconLoader on
+    // macOS (SIGTRAP, not a catchable error) — see issue #3352.
+    assert.notEqual(BUNDLE_ICON_OPTIONS.size as string, 'large');
+  });
+
   it('walks three levels up from the executable to the .app', () => {
     assert.deepEqual(
       resolveAppBundle({
diff --git a/apps/desktop/src/main/permission-overlay/app-bundle.ts b/apps/desktop/src/main/permission-overlay/app-bundle.ts
index 4c148f151..01767a101 100644
--- a/apps/desktop/src/main/permission-overlay/app-bundle.ts
+++ b/apps/desktop/src/main/permission-overlay/app-bundle.ts
@@ -34,6 +34,15 @@ export interface ResolveAppBundleDeps {
   exists(path: string): boolean;
 }
 
+/**
+ * The only size every platform can actually deliver. `'large'` is
+ * unsupported on macOS: Chromium's IconLoader hits a fatal NOTREACHED and
+ * the process dies with SIGTRAP before the promise settles — no JavaScript
+ * error is ever thrown, so the try/catch in `loadNativeBundleIcon` cannot
+ * save the app. Callers upscale the 32x32 result as needed.
+ */
+export const BUNDLE_ICON_OPTIONS = { size: 'normal' } as const;
+
 /**
  * Reading a bundle icon is presentation-only. The original unpackaged npm
  * Electron runtime could terminate natively while macOS resolved its bundle
diff --git a/apps/desktop/src/main/permission-overlay/permission-overlay-main.ts b/apps/desktop/src/main/permission-overlay/permission-overlay-main.ts
index c9a992d77..9aa770197 100644
--- a/apps/desktop/src/main/permission-overlay/permission-overlay-main.ts
+++ b/apps/desktop/src/main/permission-overlay/permission-overlay-main.ts
@@ -24,7 +24,7 @@ import { join } from 'node:path';
 import type { UiLocale } from '@maka/core/ui-locale';
 import { resolveOverlayAssetDir } from '../overlay-assets.js';
 import { openSystemPermissionPane, requestPermissionAccess } from '../permissions-actions.js';
-import { loadNativeBundleIcon, resolveAppBundle } from './app-bundle.js';
+import { BUNDLE_ICON_OPTIONS, loadNativeBundleIcon, resolveAppBundle } from './app-bundle.js';
 import { getPermissionOverlayCopy } from './permission-overlay-copy.js';
 import {
   createPermissionOverlayController,
@@ -77,7 +77,7 @@ export function createPermissionOverlayMain(
   async function resolveAppIconDataUrl(bundlePath: string | null): Promise<string | null> {
     if (!bundlePath) return null;
     const icon = await loadNativeBundleIcon(app.isPackaged, () =>
-      app.getFileIcon(bundlePath, { size: 'large' }),
+      app.getFileIcon(bundlePath, BUNDLE_ICON_OPTIONS),
     );
     if (!icon || icon.isEmpty()) return null;
     // nativeImage.createFromPath does not decode .icns reliably. Asking
@@ -274,7 +274,7 @@ function attachCardGestures(win: import('electron').BrowserWindow): void {
     }
     if (icon.isEmpty()) {
       const fallback = await loadNativeBundleIcon(app.isPackaged, () =>
-        app.getFileIcon(resolved.bundlePath, { size: 'large' }),
+        app.getFileIcon(resolved.bundlePath, BUNDLE_ICON_OPTIONS),
       );
       if (fallback && !fallback.isEmpty()) icon = fallback.resize({ width: 64, height: 64 });
       // The file drag still works without a decorative drag image.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org