Skip to content

[Bug]: segfault in dialog.showMessageBox under native Wayland #33325

@p2004a

Description

@p2004a

Preflight Checklist

Electron Version

17.1.2

What operating system are you using?

Other Linux

Operating System Version

Linux 5.15.0-3-amd64 #1 SMP Debian 5.15.15-2 (2022-01-30) x86_64 GNU/Linux

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

electron.dialog.showMessageBox shows a dialog without crashing under wayland.

Actual Behavior

Application segfaults.

Testcase Gist URL

No response

Additional Information

This is not the same as #32436, the stacktrace is different, but explanation from Maksim in #32436 (comment) is still valid: electron calls x11 objects even when not running on wayland.

Here is the stacktrace of segmentation fault I get:

#0  0x00007ffff66bb0c0 in xcb_poll_for_event () from /lib/x86_64-linux-gnu/libxcb.so.1
#1  0x0000555557ed3113 in x11::Connection::ReadResponse (this=0x1e7a002cf988, queued=<optimized out>) at ../../ui/gfx/x/connection.cc:372
#2  0x0000555557ed3053 in x11::Connection::ReadResponses (this=0x1e7a002cf988) at ../../ui/gfx/x/connection.cc:365
#3  0x000055555af5bd09 in ui::X11EventSource::GetCurrentServerTime (this=0x1e7a002cf900) at ../../ui/events/platform/x11/x11_event_source.cc:179
#4  0x00005555576ef2eb in electron::(anonymous namespace)::GtkMessageBox::Show (this=0x1e7a027cb3e0) at ../../electron/shell/browser/ui/message_box_gtk.cc:168
#5  electron::(anonymous namespace)::GtkMessageBox::RunAsynchronous(base::OnceCallback<void (int, bool)>) (this=0x1e7a027cb3e0, callback=...) at ../../electron/shell/browser/ui/message_box_gtk.cc:187
#6  electron::ShowMessageBox(electron::MessageBoxSettings const&, base::OnceCallback<void (int, bool)>) (settings=..., callback=...) at ../../electron/shell/browser/ui/message_box_gtk.cc:240
#7  0x00005555575c3186 in (anonymous namespace)::ShowMessageBox (settings=..., args=<optimized out>) at ../../electron/shell/browser/api/electron_api_dialog.cc:47
#8  0x00005555575c3f10 in base::RepeatingCallback<v8::Local<v8::Promise> (electron::MessageBoxSettings const&, gin::Arguments*)>::Run(electron::MessageBoxSettings const&, gin::Arguments*) const & (this=0x7fffffffb6d8, 
    args=0x1e7a02bce280, args=0x1e7a02bce280) at ../../base/callback.h:241
#9  gin_helper::Invoker<gin_helper::IndicesHolder<0ul, 1ul>, electron::MessageBoxSettings const&, gin::Arguments*>::DispatchToCallback<v8::Local<v8::Promise> >(base::RepeatingCallback<v8::Local<v8::Promise> (electron::MessageBoxSettings const&, gin::Arguments*)>) (this=0x7fffffffb6e0, callback=...) at ../../electron/shell/common/gin_helper/function_template.h:222
#10 gin_helper::Dispatcher<v8::Local<v8::Promise> (electron::MessageBoxSettings const&, gin::Arguments*)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&) (info=...)
    at ../../electron/shell/common/gin_helper/function_template.h:264
#11 0x000055555862eb7b in v8::internal::FunctionCallbackArguments::Call (this=0x7fffffffb890, handler=...) at ../../v8/src/api/api-arguments-inl.h:152
#12 v8::internal::(anonymous namespace)::HandleApiCallHelper<false> (isolate=0x1e7a00620000, fun_data=..., receiver=..., function=..., new_target=..., args=...) at ../../v8/src/builtins/builtins-api.cc:112
#13 v8::internal::Builtin_Impl_HandleApiCall (args=..., isolate=0x1e7a00620000) at ../../v8/src/builtins/builtins-api.cc:142
#14 v8::internal::Builtin_HandleApiCall (args_length=<optimized out>, args_object=<optimized out>, isolate=<optimized out>) at ../../v8/src/builtins/builtins-api.cc:130

The fault happens on this line: https://github.com/electron/electron/blob/main/shell/browser/ui/message_box_gtk.cc#L168 which depends on x11 stuff unconditionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions