From 8fb521135caf8ac18dba1163cb82ed1b5ef579f4 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Wed, 27 Feb 2019 08:40:06 +0100 Subject: [PATCH] action-row: Upcast self to check the activated row Upcast the HdyActionRow rather than downcasting the activated row to compare their pointers. This prevents error messages when a sibbling row that isn't a HdyActionRow is activated. Also use a simple cast rather than a safe cast as it is there only to please the compiler and is useless for a pointer comparison and it's faster. --- src/hdy-action-row.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hdy-action-row.c b/src/hdy-action-row.c index 4467cc72..0d490ac0 100644 --- a/src/hdy-action-row.c +++ b/src/hdy-action-row.c @@ -72,10 +72,11 @@ enum { static GParamSpec *props[LAST_PROP]; static void -row_activated_cb (HdyActionRow *self, +row_activated_cb (HdyActionRow *self, GtkListBoxRow *row) { - if (self == HDY_ACTION_ROW (row)) + /* No need to use GTK_LIST_BOX_ROW() for a pointer comparison. */ + if ((GtkListBoxRow *) self == row) hdy_action_row_activate (self); } -- GitLab