gtk4/3e3158ce12741b58ce53f132b48f26438094886d.patch
Bjørn Lie eae0b7ccb4 Accepting request 1070735 from GNOME:Next
- Add 3e3158ce12741b58ce53f132b48f26438094886d.patch: widget: Use
  the correct template in dispose_template(). Fixes crashes in
  various apps.
- Refresh patches with quilt.

OBS-URL: https://build.opensuse.org/request/show/1070735
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk4?expand=0&rev=119
2023-03-10 20:51:50 +00:00

30 lines
1.2 KiB
Diff

From 9b3fb66bd4568c05f4bd10bda7f6cc1d2ed6919e Mon Sep 17 00:00:00 2001
From: Alexander Mikhaylenko <alexm@gnome.org>
Date: Mon, 6 Mar 2023 05:36:16 +0400
Subject: [PATCH] widget: Use the correct template in dispose_template()
In derivable classes, the widget's class can be different from the one
dispose_template() was called for, which can lead to failing the
template != NULL check at best, undefined behavior at worst.
Since we already pass the correct GType into the function, just use that
instead.
---
gtk/gtkwidget.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: gtk-4.10.0/gtk/gtkwidget.c
===================================================================
--- gtk-4.10.0.orig/gtk/gtkwidget.c
+++ gtk-4.10.0/gtk/gtkwidget.c
@@ -11180,7 +11180,8 @@ gtk_widget_dispose_template (GtkWidget *
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (g_type_name (widget_type) != NULL);
- GtkWidgetTemplate *template = GTK_WIDGET_GET_CLASS (widget)->priv->template;
+ GObjectClass *object_class = g_type_class_peek (widget_type);
+ GtkWidgetTemplate *template = GTK_WIDGET_CLASS (object_class)->priv->template;
g_return_if_fail (template != NULL);
/* Tear down the automatic child data */