You are not logged in.

#1 2025-06-14 19:28:26

iamkroot
Member
Registered: 2024-03-31
Posts: 3

Firefox `GDK_IS_WAYLAND_WINDOW (window)` assertion failures on wayland

Problem:

Getting semi-frequent "Gdk-CRITICAL" assertion failures triggered by opening context menus (and other actions) in firefox-

(firefox-developer-edition:221263): Gdk-CRITICAL **: 09:53:20.026: gdk_wayland_window_set_dbus_properties_libgtk_only: assertion 'GDK_IS_WAYLAND_WINDOW (window)' failed

Note that firefox is running under Wayland (KDE Plasma 6.3), so this error message is not expected.

Steps to repro:
  1. Open a console inside a wayland session

  2. Run firefox -P, create a new temp profile

  3. Right click to open a context menu

  4. Note error logs in firefox output

Some initial debugging results:

Running firefox under gdb and putting a breakpoint at gdk_wayland_window_set_dbus_properties_libgtk_only helps.

Backtrace
#0  gdk_wayland_window_set_dbus_properties_libgtk_only
    (window=window@entry=0x0, application_id=application_id@entry=0x7fffbdd314a0 "firefox-developer-edition", app_menu_path=app_menu_path@entry=0x0, menubar_path=menubar_path@entry=0x7fffb90bffa0 "/org/appmenu/gtk/window/menus/menubar/12", window_object_path=window_object_path@entry=0x7fffbdccc580 "/org/appmenu/gtk/window/menus/menubar/12/window/12", application_object_path=application_object_path@entry=0x7fffbdd31be0 "/org/appmenu/gtk/window", unique_bus_name=0x7fffb43cb9a0 ":1.2674")
    at ../gtk/gdk/wayland/gdkwindow-wayland.c:5375
#1  0x00007fffd810eb8e in gtk_wayland_window_get_window_data (window=0x7fffbd54c960) at ../vala-panel-appmenu/subprojects/appmenu-gtk-module/src/platform.c:399
#2  gtk_window_get_window_data (window=window@entry=0x7fffbd54c960) at ../vala-panel-appmenu/subprojects/appmenu-gtk-module/src/datastructs.c:153
#3  0x00007fffd810f108 in hijacked_window_realize (widget=0x7fffbd54c960) at ../vala-panel-appmenu/subprojects/appmenu-gtk-module/src/hijack.c:85
#4  hijacked_window_realize (widget=0x7fffbd54c960) at ../vala-panel-appmenu/subprojects/appmenu-gtk-module/src/hijack.c:69
#9  0x00007ffff60677c4 in <emit signal 'realize' on instance ???> (instance=instance@entry=0x7fffbd54c960, signal_id=<optimized out>, detail=detail@entry=0)
    at ../glib/gobject/gsignal.c:3597
    #5  0x00007ffff604683a in g_closure_invoke (closure=0x7fffe6e5a1a0, return_value=0x0, n_param_values=1, param_values=0x7fffffff93f0, invocation_hint=0x7fffffff9340)
    at ../glib/gobject/gclosure.c:835
    #6  0x00007ffff6065573 in signal_emit_unlocked_R
    (node=node@entry=0x7fffffff94e0, detail=detail@entry=0, instance=instance@entry=0x7fffbd54c960, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffff93f0) at ../glib/gobject/gsignal.c:3735
    #7  0x00007ffff606748f in signal_emit_valist_unlocked
    (instance=instance@entry=0x7fffbd54c960, signal_id=signal_id@entry=58, detail=detail@entry=0, var_args=var_args@entry=0x7fffffff9640) at ../glib/gobject/gsignal.c:3534
    #8  0x00007ffff6067709 in g_signal_emit_valist (instance=0x7fffbd54c960, signal_id=58, detail=0, var_args=var_args@entry=0x7fffffff9640) at ../glib/gobject/gsignal.c:3277
#10 0x00007ffff5d9b2d6 in gtk_widget_realize (widget=0x7fffbd54c960) at ../gtk/gtk/gtkwidget.c:5525
#11 gtk_widget_realize (widget=0x7fffbd54c960) at ../gtk/gtk/gtkwidget.c:5492
#12 0x00007fffed0fb73c in nsWindow::Create (this=0x7fffc17bb500, aParent=0x7fffc9e20000, aRect=<optimized out>, aInitData=<optimized out>)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/widget/gtk/nsWindow.cpp:6171
#13 0x00007fffed0fb293 in nsBaseWidget::CreateChild (this=0x7fffc9e20000, aRect=..., aInitData=...)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/widget/nsBaseWidget.cpp:510
#14 0x00007fffec02b052 in nsView::CreateWidgetForPopup (this=0x7fffc1770270, aWidgetInitData=0x7fffffff98de, aParent=0x7fffc9e20000)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/view/nsView.cpp:511
#15 nsMenuPopupFrame::CreateWidgetForView (this=0x7fffc1752558, aView=0x7fffc1770270)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/layout/xul/nsMenuPopupFrame.cpp:309
#16 0x00007fffefcc4ef2 in nsMenuPopupFrame::PrepareWidget (this=<optimized out>, aForceRecreate=<optimized out>)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/layout/xul/nsMenuPopupFrame.cpp:245
#17 0x00007fffefcc75ae in nsMenuPopupFrame::InitializePopupAtScreen (this=0x0, aTriggerContent=0x7fffc3e96600, aXPos=0, aYPos=-1190396000, aIsContextMenu=false)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/layout/xul/nsMenuPopupFrame.cpp:904
#18 0x00007fffefcd0c9f in nsXULPopupManager::ShowPopupAtScreen
    (this=0x7fffe3df2310, aPopup=<optimized out>, aXPos=590, aYPos=44, aIsContextMenu=<optimized out>, aTriggerEvent=<optimized out>)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/layout/xul/nsXULPopupManager.cpp:932
#19 0x00007fffef900a2e in nsXULPopupListener::LaunchPopup (this=0x7fffc3675220, aEvent=0x7fffbad8c580)
    at /usr/src/debug/firefox-developer-edition/firefox-140.0/dom/xul/nsXULPopupListener.cpp:279
Main issue
  • The assertion GDK_IS_WAYLAND_WINDOW (window) is failing at frame 0 because the window pointer is NULL.

  • Looking at the impl of gtk_wayland_window_get_window_data in appmenu-gtk-module/src/platform.c, we see that the pointer is initialized as- gdk_win = gtk_widget_get_window(GTK_WIDGET(window)); and this gdk_win is passed as the first arg (window) to `set_dbus_properties.

  • Essentially, gtk_widget_get_window(GTK_WIDGET(window)); is returning NULL for the given context menu popup widget.

  • The GTK_WIDGET window (pointer 0x7fffbd54c960) comes from inside firefox nsWindow::Create (frame 12) initialized as the mShell variable

    • Call to gtk_widget_realize(mShell);

  • Looks like they forget to call gtk_widget_set_window somehow?

Offline

#2 2025-06-14 19:39:38

seth
Member
Registered: 2012-09-03
Posts: 64,524

Re: Firefox `GDK_IS_WAYLAND_WINDOW (window)` assertion failures on wayland

Is that only w/ (sub?) menus from the menubar? Toplevel menus don't cause this?
Not every wayland compositor allows popups w/o a or the wrong™  parent window, but that's pretty typical code (because menus often get reused in various places) - Qt throws a similar error in that case - does FF also crash or just continue to work?

Frankly not sure whether that's a FF or GTK bug (the toolkit should™ probably properly reparent the window before spawning it)

Offline

#3 2025-06-14 19:49:42

iamkroot
Member
Registered: 2024-03-31
Posts: 3

Re: Firefox `GDK_IS_WAYLAND_WINDOW (window)` assertion failures on wayland

This is not just sub-menus or the menu bar. Any firefox popup is causing it- including a context menu spawned by a right click.

Firefox continues to work, but something is obviously broken somewhere™.

Offline

#4 2025-06-14 19:52:15

seth
Member
Registered: 2012-09-03
Posts: 64,524

Re: Firefox `GDK_IS_WAYLAND_WINDOW (window)` assertion failures on wayland

Firefox continues to work, but something is obviously broken somewhere™.

"wayland" tongue

https://www.google.com/search?q="gdk_wayland_window_set_dbus_properties_libgtk_only%3A+assertion+'GDK_IS_WAYLAND_WINDOW+(window)'+failed" - this isn't FF specific at all.

Offline

Board footer

Powered by FluxBB