From 04aca0129c479891ff5fe47417e9217669f0df62 Mon Sep 17 00:00:00 2001 From: Xiang Fan Date: Tue, 26 Feb 2019 10:27:45 +0800 Subject: [PATCH] account: Downgrade scroll for callbacks --- fractal-gtk/src/app/connect/account.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fractal-gtk/src/app/connect/account.rs b/fractal-gtk/src/app/connect/account.rs index 598aea92..eb5b2347 100644 --- a/fractal-gtk/src/app/connect/account.rs +++ b/fractal-gtk/src/app/connect/account.rs @@ -288,22 +288,23 @@ impl App { op.lock().unwrap().account_destruction(); })); - let scroll = builder + let scroll_weak = builder .get_object::("account_settings_scroll") - .expect("Can't find account_settings_scroll in ui file."); - delete_revealer.connect_size_allocate(clone!(scroll => move |this, _| { + .expect("Can't find account_settings_scroll in ui file.") + .downgrade(); + delete_revealer.connect_size_allocate(clone!(scroll_weak => move |this, _| { if this.get_reveal_child() && !this.get_child_revealed() { // The revealer is revealing - if let Some(adj) = scroll.get_vadjustment() { + if let Some(adj) = upgrade_weak!(scroll_weak).get_vadjustment() { let bottom = adj.get_upper() - adj.get_page_size(); adj.set_value(bottom); } } })); - advanced_revealer.connect_size_allocate(clone!(scroll => move |this, _| { + advanced_revealer.connect_size_allocate(clone!(scroll_weak => move |this, _| { if this.get_reveal_child() && !this.get_child_revealed() { // The revealer is revealing - if let Some(adj) = scroll.get_vadjustment() { + if let Some(adj) = upgrade_weak!(scroll_weak).get_vadjustment() { let bottom = adj.get_upper() - adj.get_page_size(); adj.set_value(bottom); }