From 86271b3717f1aa499457b75caf1d44e0e64bda6b Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 7 Nov 2023 15:23:47 +0100 Subject: Fix various instance checks The g_return*_if_fail() calls should use PREFIX_IS_TYPE_NAME [1], which returns whether the given instance is of the right type, not PREFIX_TYPE_NAME [2], which checks whether the given instance if of the right type, warns if not, and returns the passed-in instance unchanged. Using the wrong one means the returned value is the passed-in pointer, and thus passes the g_return*_if_fail() whenever the pointer is non-NULL, no matter whether it's of the right type or not. A warning would still be emitted by g_type_check_instance_cast(), but the execution wouldn't get short-circuited. [1] calls g_type_check_instance_is_a() [2] calls g_type_check_instance_cast() --- mate-volume-control/gvc-stream-applet-icon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mate-volume-control/gvc-stream-applet-icon.c') diff --git a/mate-volume-control/gvc-stream-applet-icon.c b/mate-volume-control/gvc-stream-applet-icon.c index da8020f..7f52972 100644 --- a/mate-volume-control/gvc-stream-applet-icon.c +++ b/mate-volume-control/gvc-stream-applet-icon.c @@ -575,7 +575,7 @@ void gvc_stream_applet_icon_set_display_name (GvcStreamAppletIcon *icon, const gchar *name) { - g_return_if_fail (GVC_STREAM_APPLET_ICON (icon)); + g_return_if_fail (GVC_IS_STREAM_APPLET_ICON (icon)); g_free (icon->priv->display_name); @@ -589,7 +589,7 @@ void gvc_stream_applet_icon_set_control (GvcStreamAppletIcon *icon, MateMixerStreamControl *control) { - g_return_if_fail (GVC_STREAM_APPLET_ICON (icon)); + g_return_if_fail (GVC_IS_STREAM_APPLET_ICON (icon)); if (icon->priv->control == control) return; -- cgit v1.2.1