From 81948425d897ecc1257269f5413f664dd6572446 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Thu, 9 Dec 2021 12:41:58 +0000 Subject: [PATCH] popover: Fix reentrancy problem Calling popover.show() returns control to the main loop, but squeekboard structures are still borrowed meanwhile. That's dangerous and forbidden in Rust. Therefore, this forces the return from the stack and release of the borrows before the glib main loop is invoked again. --- src/popover.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/popover.rs b/src/popover.rs index feec80f1..bee817ee 100644 --- a/src/popover.rs +++ b/src/popover.rs @@ -360,5 +360,8 @@ pub fn show( menu.insert_action_group("popup", Some(&action_group)); menu.bind_model(Some(&model), Some("popup")); - menu.popup(); + glib::idle_add_local(move || { + menu.popup(); + Continue(false) + }); }