From 86fba1dc6995bca117cee30974e53ce0ea126db7 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 10 Nov 2024 12:05:36 +0200 Subject: [PATCH] fix reference count for action group arguments --- src/app/browser.rs | 20 ++++++++++++++++---- src/app/browser/widget.rs | 4 ++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/app/browser.rs b/src/app/browser.rs index dc3e2b68..0263de6a 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -37,10 +37,22 @@ impl Browser { let widget = Rc::new(Widget::new( window.gobject(), &[ - // Connect action groups - (action.id(), action.gobject()), - (window.action().id(), window.action().gobject()), - (window.tab().action().id(), window.tab().action().gobject()), + // Connect action groups (to apply accels) + ( + // Browser + action.id(), + action.gobject().clone(), + ), + ( + // Window + window.action().id(), + window.action().gobject().clone(), + ), + ( + // Tab + window.tab().action().id(), + window.tab().action().gobject().clone(), + ), ], )); diff --git a/src/app/browser/widget.rs b/src/app/browser/widget.rs index 5b127b05..1b153217 100644 --- a/src/app/browser/widget.rs +++ b/src/app/browser/widget.rs @@ -22,7 +22,7 @@ impl Widget { // Construct pub fn new( content: &impl IsA, - action_groups: &[(&GString, &SimpleActionGroup)], + action_groups: &[(&GString, SimpleActionGroup)], ) -> Self { // Init GTK let gobject = ApplicationWindow::builder() @@ -34,7 +34,7 @@ impl Widget { // Register actions for (name, group) in action_groups { - gobject.insert_action_group(name, Some(group.clone())); + gobject.insert_action_group(name, Some(group)); } // Return new struct