Skip to content

'paint' event not triggered when using useSharedTexture in window opened by setWindowOpenHandler #46853

Closed

Description

@benoitlahoz

Preflight Checklist

Electron Version

34.5.1

What operating system(s) are you using?

macOS

Operating System Version

macOS Monterey 12.7.6

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Expect the new window, opened from renderer through setWindowOpenHandler with overrideBrowserWindowOptions or createWindow, to trigger the 'paint' event.

Actual Behavior

'paint' event is not triggered, as if the useSharedTexture option (thank you @reitowo!) wasn't taken into account.

Testcase Gist URL

Unable to publish a gist but here is the repository.
Relevant files are window.ts for main process, and MainView.vue, SyphonView.vue for renderer one.

In the application click 'Create Server'.

Additional Information

Use case
I want to create or consume canvases in the visible window (think of incoming WebRTC streams, drawable canvas, etc.) and to 'clone' them (drawImage) at their real size in an OSR window. Then, in the 'paint' event I would be able to publish the frame handle to my node native addon (node-syphon).

Activity

  1. added theissue type on Apr 29, 2025
  2. benoitlahoz commented on Apr 29, 2025

    @benoitlahoz
    Author

    Update: tested with v36.0.0, with same results.

  3. nikwen commented on Apr 29, 2025

    @nikwen
    Member

    Thanks for reporting!

    Unfortunately, the Electron team is small and does not have the capacity to work with testcases with third-party dependencies (e.g. Vue). For one of us to be able to take a look, could you please publish a vanilla JS testcase gist with Electron Fiddle? (If you run into problems with publishing gists, it's usually related to authentication. Try removing the GitHub auth token and creating a new one.)

    Applying the blocked/need-repro label until this is resolved. Thanks!

  4. added
    blocked/need-repro
    on Apr 29, 2025
  5. electron-issue-triage commented on Apr 29, 2025

    @electron-issue-triage

    Hello @benoitlahoz. 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.

  6. moved this to 👀 Unsorted Items in 36-x-yon Apr 29, 2025
  7. benoitlahoz commented on Apr 29, 2025

    @benoitlahoz
    Author

    Thank you for your message @nikwen.

    I reproduced the issue in Fiddle, here is the gist: https://gist.github.com/benoitlahoz/2b61d73397e1db0e7fa51873757f312d

    It's the first time I do it, I hope everything is OK.
    I can also create a repo from the Fiddle output (very powerful indeed).

    Thank you.

  8. removed
    blocked/need-repro
    on Apr 29, 2025
  9. nikwen commented on Apr 29, 2025

    @nikwen
    Member

    Thanks!

    You might be running into #32001, which was addressed on macOS in #46615.

    Can you check if the latest v35 or v36 builds fix the issue on macOS?

  10. added
    has-repro-gist
    blocked/need-info ❌
    on Apr 29, 2025
  11. benoitlahoz commented on Apr 29, 2025

    @benoitlahoz
    Author

    Thank you.
    I tested on v36 with same problem.
    I went to the issues you mention, but it really looks like the 'offscreen' option object is not handled in this case.
    I may miss something though 🙃🤨

  12. removed
    blocked/need-info ❌
    on Apr 29, 2025
  13. nikwen commented on Apr 29, 2025

    @nikwen
    Member

    Thanks for testing! That's helpful info. (Sorry for asking again after you had already specified that earlier.)

  14. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 36-x-yon Apr 30, 2025
  15. codebytere commented on May 1, 2025

    @codebytere
    Member

    @reitowo would you be able to take a look?

  16. reitowo commented on May 2, 2025

    @reitowo
    Member

    I found paint event also doesn't work, even without sharedTexture enabled. By tracing, I found WebContents::WebContents was called only once (where the offscreen was considered), while BrowserWindow called twice.

    In electron_api_web_contents.cc:4555 gin::Handle<WebContents> WebContents::CreateFromWebPreferences it will read from (web_preferences.GetHidden("webContents", &web_contents) to use the existing webContents object instead of constructing a new one with parameters. @codebytere

    I'm not sure if this logic can be tampered with, this bug is not specifically related to OSR. Many things was decided at the constructor of WebContents, update the preference later doesn't change that. If possible, we may invalidating webContents cache when these settings changed, but I don't even know if this is a "caching" logic.

    Image

  17. benoitlahoz commented on Jul 9, 2025

    @benoitlahoz
    Author

    Any news on this one @reitowo ?

  18. reitowo commented on Aug 5, 2025

    @reitowo
    Member

    Should be resolved by the referencing PR.

  19. codebytere commented on Aug 5, 2025

    @codebytere
    Member

    Closed in #47868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    34-x-y36-x-ybug 🪲component/offscreenhas-repro-gistplatform/macOS

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions