From 133f3834653f1cb0c3b66f984f2498a361c87812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Thu, 19 Oct 2023 15:54:57 +0200 Subject: [PATCH] gio: Use weak reference to ActionMap when adding action entries Otherwise it is not possible to drop the ActionMap without dropping the actions first. --- gio/src/action_map.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/src/action_map.rs b/gio/src/action_map.rs index 24a77826511c..08bb71f2b73e 100644 --- a/gio/src/action_map.rs +++ b/gio/src/action_map.rs @@ -20,13 +20,13 @@ pub trait ActionMapExtManual: sealed::Sealed + IsA { }; let action_map = self.as_ref(); if let Some(callback) = entry.activate { - action.connect_activate(clone!(@strong action_map => move |action, state| { + action.connect_activate(clone!(@weak action_map => move |action, state| { // safe to unwrap as O: IsA callback(action_map.downcast_ref::().unwrap(), action, state); })); } if let Some(callback) = entry.change_state { - action.connect_change_state(clone!(@strong action_map => move |action, state| { + action.connect_change_state(clone!(@weak action_map => move |action, state| { // safe to unwrap as O: IsA callback(action_map.downcast_ref::().unwrap(), action, state); }));