Skip to content

popover: Fix reentrancy problem

dcz requested to merge dcz/squeekboard:submission into master

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.

The stack trace calls release() twice:

...
13 rs::layout::c::procedures::squeek_layout_release                                                                                                                                     layout.rs          220  0x4f4146       
14 release                                                                                                                                                                              eek-gtk-keyboard.c 198  0x447b35       
15 eek_gtk_keyboard_leave_event                                                                                                                                                         eek-gtk-keyboard.c 231  0x447c45       
...
33 gtk_widget_show                                                                                                                                                                                              0x7ffff7768756 
34 gtk_popover_popup                                                                                                                                                                                            0x7ffff76741f8 
35 gtk::auto::popover::{impl#2}::popup<gtk::auto::popover::Popover>                                                                                                                     popover.rs         670  0x51788c       
36 rs::popover::show                                                                                                                                                                    popover.rs         363  0x4d1051       
37 rs::layout::seat::handle_release_key                                                                                                                                                 layout.rs          1079 0x148d81d      
38 rs::layout::c::procedures::squeek_layout_release                                                                                                                                     layout.rs          230  0x4f43e9       
39 release                                                                                                                                                                              eek-gtk-keyboard.c 198  0x447b35       
40 eek_gtk_keyboard_real_button_release_event                                                                                                                                           eek-gtk-keyboard.c 220  0x447c01       
...

Merge request reports