-
-
Notifications
You must be signed in to change notification settings - Fork 79
Description
see reproduction here:
https://github.com/emmanueltouzery/relm_process_events
the code adds 100k rows in a gtk treeview. It does so through a busy loop in the gtk GUI thread. BUT it doesn't freeze the GUI thread because it regularly calls:
while gtk::events_pending() {
gtk::main_iteration();
}however that is not enough apparently to enable relm's event processing. It seems relm components' update() methods are called only after such a busy loop.
In this repro, I listen to double clicks on grid rows. When there is such a double click, I make a println!()... this works during the busy loop:
[src/main.rs:46] i = 65398
[src/main.rs:46] i = 65399
[src/main.rs:46] i = 65400
emitting relm event
[src/main.rs:46] i = 65401
[src/main.rs:46] i = 65402
however the update() itself, that should be called as a result of the stream().emit() being invoked, is not invoked until after the busy loop finishes:
fn update(&mut self, event: Msg) {
dbg!(event);
}[src/main.rs:46] i = 99997
[src/main.rs:46] i = 99998
[src/main.rs:46] i = 99999
emitting relm event
[src/main.rs:69] event = RowClicked
emitting relm event
[src/main.rs:69] event = RowClicked
emitting relm event
[src/main.rs:69] event = RowClicked