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.
This commit is contained in:
Alexander Mikhaylenko 2023-03-06 05:36:16 +04:00
parent dbaaa59758
commit 9b3fb66bd4

View File

@ -11128,7 +11128,8 @@ gtk_widget_dispose_template (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (g_type_name (widget_type) != NULL); 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); g_return_if_fail (template != NULL);
/* Tear down the automatic child data */ /* Tear down the automatic child data */