electron [Bug]: 如果在创建BrowserWindow之前调用screen.getCursorScreenPoint(),则会在Wayland下导致段错误,

wkyowqbh  于 4个月前  发布在  Electron
关注(0)|答案(2)|浏览(45)

预检清单

Electron 版本

29.1.1

您正在使用的操作系统是什么?

其他 Linux

您正在使用的操作系统版本是什么?

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

您正在使用的架构是什么?

x64

最后已知的工作 Electron 版本

我检查了尽可能早的 Electron 17,但找不到一个不会崩溃的版本(由于其他原因,无法在较早的版本上正确使用 Wayland)

预期行为

screen.getCursorScreenPoint() 在创建 BrowserWindow 之前不应发生段错误。如果无法实现,则应抛出 JavaScript 错误,并相应地更新文档。

实际行为

当我使用 Electron 29.1.1 运行以下代码时,应用程序会因 Segmentation fault (core dumped) 而崩溃。gdb 在段错误处返回以下回溯:

#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 ?? ()

在 Xwayland 下运行时(没有 --ozone-platform-hint=wayland),没有发生崩溃。

测试用例 Gist URL

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

其他信息

这是与 #35471 相同的问题。

mwg9r5ms

mwg9r5ms1#

这个问题已经被自动标记为过时。如果这个问题仍然影响到你,请留下任何评论(例如“提升”),我们会保持开放。如果你有任何新的附加信息——特别是,如果这个问题在 latest version of Electronbeta 中仍然可复现——请在你的评论中包含它!

tcomlyy6

tcomlyy62#

仍然在Electron 31.0.2中出现段错误

#0  ui::WaylandWindow::GetBoundsInDIP (this=0x0) at ../../ui/ozone/platform/wayland/host/wayland_window.cc:485
#1  0x00005555585283e2 in ui::WaylandScreen::GetCursorScreenPoint (this=0xfb8007394a0) at ../../ui/ozone/platform/wayland/host/wayland_screen.cc:400
#2  0x00005555579a60fa in base::RepeatingCallback<gfx::Point (electron::api::Screen*, v8::Isolate*)>::Run(electron::api::Screen*, v8::Isolate*) const & (this=0x7fffffffd000, args=0xfb800250000, args=0xfb800250000)
    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=0x7fffffffd050) at ../../gin/function_template.h:264
#5  0x00005555579a5f78 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  0x000055555756c43f in Builtins_CallApiCallbackGeneric ()
#7  0x00007fffffffd0e0 in ?? ()
#8  0x00007fffffffd118 in ?? ()
#9  0x0000000000000000 in ?? ()

相关问题