Skip to content

offscreen error #45486

Closed
Closed

Description

@ntoskrnl7

Preflight Checklist

Electron Version

34.0.0 or later

What operating system(s) are you using?

Windows

Operating System Version

Window 10 10.0.19045.5371

What arch are you using?

x64

Last Known Working Electron version

34.0.0 or later

Expected Behavior

The process should not be terminated even if the offscreen 'browserWindow' is closed.

ex)
const browserWindow = new BrowserWindow({ webPreferences: { offscreen: true } });
await browserWindow.loadURL('about:blank');
browserWindow.close(); // or browserWindow.webContents.executeJavaScript('window.close()');

const browserWindow2 = new BrowserWindow({ webPreferences: { offscreen: false } });
await browserWindow2.loadURL('about:blank');

Actual Behavior

Starting with 34.0.0, the process is unconditionally terminated when the offscreen 'browserWindow' is closed.

ex)
const browserWindow = new BrowserWindow({ webPreferences: { offscreen: true } });
await browserWindow.loadURL('about:blank');
browserWindow.close(); // or browserWindow.webContents.executeJavaScript('window.close()');

const browserWindow2 = new BrowserWindow({ webPreferences: { offscreen: false } });
await browserWindow2.loadURL('about:blank');

Testcase Gist URL

https://gist.github.com/ntoskrnl7/86f9aa5288e6b28794d317e97b011df1

Additional Information

No response

Activity

  1. moved this to 👀 Unsorted Items in 34-x-yon Feb 6, 2025
  2. added
    blocked/need-repro
    on Feb 6, 2025
  3. electron-issue-triage commented on Feb 6, 2025

    @electron-issue-triage

    Hello @ntoskrnl7. Thanks for reporting this and helping to make Electron better!

    Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

    Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

    Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

  4. removed
    blocked/need-repro
    on Feb 8, 2025
  5. added
    has-repro-gist
    on Feb 10, 2025
  6. nikwen commented on Feb 10, 2025

    @nikwen
    Member

    The app quits because of this line in your gist:

    https://gist.github.com/ntoskrnl7/86f9aa5288e6b28794d317e97b011df1#file-main-js-L31

    After the first window is closed, it will execute the window-all-closed callback because at that point all windows are closed. Change the behavior of that callback to not close the app and you'll achieve what you want to achieve.

  7. ntoskrnl7 commented on Feb 10, 2025

    @ntoskrnl7
    ContributorAuthor

    @nikwen It has nothing to do with window-all-closed.

    Because it only closes one offscreen window.

    Have you tried removing the window-all-closed part and running your code?

    It seems like it's more important to fix the bug than to close the issue.

  8. nikwen commented on Feb 11, 2025

    @nikwen
    Member

    You are right. I ran the gist. The process crashes when close() is called on the window.

    On Windows, it crashes with exit code 3221225477.

    On macOS, it crashes with the following message:

    [82390:0211/014516.221378:ERROR:shared_memory_switch.cc(244)] Mach rendezvous failed, terminating process (parent died?)
    
    Electron exited with signal SIGSEGV.
    

    The code runs fine on Electron v33.4.0 and crashes on Electron v34.0.0+.

  9. reopened this on Feb 11, 2025
  10. added
    bug/regression ↩️
    status/confirmed
    and removed on Feb 11, 2025
  11. self-assigned this
    on Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

34-x-ybug 🪲bug/regression ↩️crash 💥has-repro-gistplatform/allstatus/confirmed

Type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions