patch 9.2.0563: GTK3/Wayland: crash with right mouse-button in tabline

Problem:  GTK3/Wayland: crash with right mouse-button in tabline
Solution: Use gui.mainwin and get coordinates (Christoffer Aasted).

GtkNotebook (tabline) is a windowless container widget causing a
nullptr deref inside `gdk_window_get_effective_parent()` as Wayland
lacks a surface to anchor to.

fixes:  #18864
closes: #20348

Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christoffer Aasted
2026-05-29 19:39:04 +00:00
committed by Christian Brabandt
parent dda45ba88f
commit 92510c09ed
3 changed files with 24 additions and 1 deletions
+11
View File
@@ -3435,6 +3435,17 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
if (bevent->button == 3)
{
# if GTK_CHECK_VERSION(3,22,2)
# ifdef GDK_WINDOWING_WAYLAND
if (gui.is_wayland)
{
int x2, y2;
gui_gtk_get_pointer(gui.mainwin, &x2, &y2, NULL);
gtk_menu_popup_at_rect(GTK_MENU(widget),
gtk_widget_get_window(gui.mainwin), &(GdkRectangle){x2, y2, 1, 1},
GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL);
}
else
# endif
gtk_menu_popup_at_pointer(GTK_MENU(widget), event);
# else
gtk_menu_popup(GTK_MENU(widget), NULL, NULL, NULL, NULL,
+11 -1
View File
@@ -50,7 +50,17 @@ def Test_source_files()
continue
endif
var skip = 'getline(".") =~ "condition) {" || getline(".") =~ "vimglob_func" || getline(".") =~ "{\"" || getline(".") =~ "{\\d" || getline(".") =~ "{{{"'
# ignore patterns:
# - condition) {
# - vimglob_func
# - struct initializer: {"
# - numeric initializer: {\d
# - fold marker {{{
# - compound literals: (\w\+) *{
var skip = 'getline(".") =~ "condition) {" || getline(".") =~ "vimglob_func" || getline(".") =~ "{\"" ||'
skip ..= ' getline(".") =~ "{\\d" || getline(".") =~ "{{{" || getline(".") =~ "(\\w\\+) *{"'
PerformCheck(fname, ')\s*{', 'curly after closing paren', skip)
# Examples in comments use double quotes.
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
563,
/**/
562,
/**/