From 08d357dc9804abb618dd17e601558935ec112793 Mon Sep 17 00:00:00 2001 From: deepend Date: Fri, 23 Jan 2026 22:08:17 -0700 Subject: [PATCH] Added explicit GTK3-only branches in gtk_xtext_unrealize() so gtk_widget_get_window() is used without GTK2 struct access leaking into the GTK3 path. Split the GTK3 and GTK2 initialization paths in gtk_xtext_realize() so the GTK3 branch uses gtk_widget_get_allocation()/gtk_widget_get_parent_window() and the GTK2 branch keeps the direct struct access under #if !HAVE_GTK3. --- src/fe-gtk/xtext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index b0efcd25..c949bcf4 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -733,7 +733,8 @@ gtk_xtext_unrealize (GtkWidget * widget) #if HAVE_GTK3 if (window) gdk_window_set_user_data (window, NULL); -#else +#endif +#if !HAVE_GTK3 gdk_window_set_user_data (widget->window, NULL); #endif @@ -811,7 +812,8 @@ gtk_xtext_realize (GtkWidget * widget) gtk_widget_set_realized (widget, TRUE); gtk_widget_get_allocation (widget, &allocation); parent_window = gtk_widget_get_parent_window (widget); -#else +#endif +#if !HAVE_GTK3 gtk_widget_set_realized (widget, TRUE); allocation = widget->allocation; parent_window = widget->parent->window;