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.
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 */