Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: screen.getCursorScreenPoint() segfaults under Wayland if called before a BrowserWindow is created #41559

Open
3 tasks done
GarboMuffin opened this issue Mar 10, 2024 · 0 comments
Assignees
Labels
29-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ wayland

Comments

@GarboMuffin
Copy link

GarboMuffin commented Mar 10, 2024

Preflight Checklist

Electron Version

29.1.1

What operating system are you using?

Other Linux

Operating System Version

Linux archlinux 6.7.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 08 Mar 2024 01:59:01 +0000 x86_64 GNU/Linux, KDE Plasma 6 Wayland

What arch are you using?

x64

Last Known Working Electron version

I checked as far back as Electron 17 and could not find a version that does not crash (could not get Wayland to work properly on older versions for unrelated reasons)

Expected Behavior

screen.getCursorScreenPoint() should not segfault if called before a BrowserWindow is created. If it is not possible to implement then it should throw a JavaScript error and the documentation should be updated accordingly.

Actual Behavior

When I run the gist below with --ozone-platform-hint=wayland in Electron 29.1.1, the app dies with Segmentation fault (core dumped). gdb gives me this back trace at the segfault:

#0  ui::WaylandWindow::GetBoundsInDIP (this=0x0) at ../../ui/ozone/platform/wayland/host/wayland_window.cc:429
#1  0x0000555558491b92 in ui::WaylandScreen::GetCursorScreenPoint (this=0x3a380004ec10) at ../../ui/ozone/platform/wayland/host/wayland_screen.cc:400
#2  0x00005555579745fd in base::RepeatingCallback<gfx::Point (electron::api::Screen*, v8::Isolate*)>::Run(electron::api::Screen*, v8::Isolate*) const & (
    this=0x7fffffffd030, args=0x3a38002fc000, args=0x3a38002fc000) at ../../base/functional/callback.h:344
#3  gin::internal::Invoker<std::__Cr::integer_sequence<unsigned long, 0ul, 1ul>, electron::api::Screen*, v8::Isolate*>::DispatchToCallback<gfx::Point>(base::RepeatingCallback<gfx::Point (electron::api::Screen*, v8::Isolate*)>) (callback=..., this=<optimized out>) at ../../gin/function_template.h:225
#4  gin::internal::Dispatcher<gfx::Point (electron::api::Screen*, v8::Isolate*)>::DispatchToCallbackImpl(gin::Arguments*) (args=0x7fffffffd080)
    at ../../gin/function_template.h:264
#5  0x0000555557974488 in gin::internal::Dispatcher<gfx::Point (electron::api::Screen*, v8::Isolate*)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&) (info=...) at ../../gin/function_template.h:270
#6  0x000055555754a207 in Builtins_CallApiCallbackGeneric ()
#7  0x00007fffffffd110 in ?? ()
#8  0x00007fffffffd148 in ?? ()
#9  0x0000000000000000 in ?? ()

There is no crash when running under Xwayland (without --ozone-platform-hint=wayland)

Testcase Gist URL

https://gist.github.com/GarboMuffin/f1bfbf78b5e05d27a9bd30a6e18204a9

Additional Information

This is the same issue as #35471

@jkleinsc jkleinsc added has-repro-gist Issue can be reproduced with code at https://gist.github.com/ 29-x-y labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
29-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ wayland
Projects
No open projects
Status: 👍 Does Not Block Stable
Development

No branches or pull requests

4 participants