Fix GTK CSS warnings and popover cleanup on widget destroy
This commit is contained in:
@@ -607,6 +607,12 @@ fn attach_context_menu(widget: &impl gtk::prelude::IsA<gtk::Widget>, menu_model:
|
||||
popover.set_parent(widget.as_ref());
|
||||
popover.set_has_arrow(false);
|
||||
|
||||
// Unparent the popover when the widget is destroyed to avoid GTK warnings
|
||||
let popover_cleanup = popover.clone();
|
||||
widget.as_ref().connect_destroy(move |_| {
|
||||
popover_cleanup.unparent();
|
||||
});
|
||||
|
||||
// Right-click
|
||||
let click = gtk::GestureClick::new();
|
||||
click.set_button(3);
|
||||
|
||||
Reference in New Issue
Block a user