mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Fixed the GTK3 unrealize lifecycle in gtk_xtext_unrealize() by removing the early gdk_window_set_user_data(window, NULL) path, so the widget/window ownership remains valid until parent unrealize runs. This matches GTK’s expected unregister flow and addresses the user_data == NULL abort pattern you described.
Kept GTK2 behavior unchanged (#if !HAVE_GTK3 still clears widget->window user data in the legacy path). Added an in-code comment documenting why GTK3 must preserve user-data until chaining to parent unrealize.
This commit is contained in:
@@ -931,16 +931,13 @@ gtk_xtext_finalize (GObject *object)
|
||||
static void
|
||||
gtk_xtext_unrealize (GtkWidget * widget)
|
||||
{
|
||||
#if HAVE_GTK3
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
#endif
|
||||
backend_deinit (GTK_XTEXT (widget));
|
||||
|
||||
/* if there are still events in the queue, this'll avoid segfault */
|
||||
#if HAVE_GTK3
|
||||
if (window)
|
||||
gdk_window_set_user_data (window, NULL);
|
||||
#endif
|
||||
/*
|
||||
* Keep GtkWidget/GdkWindow association intact until parent unrealize.
|
||||
* GtkWidget's unrealize path unregisters the window and expects
|
||||
* gdk_window_get_user_data(window) == widget.
|
||||
*/
|
||||
#if !HAVE_GTK3
|
||||
gdk_window_set_user_data (widget->window, NULL);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user