Fixa krasch: RefCell-dubbellåning när popover-stacken tömdes
All checks were successful
check / check (push) Successful in 1m42s
All checks were successful
check / check (push) Successful in 1m42s
popdown() emittar closed synkront, och closed-hanteraren lånar också popover-stacken — register_popover höll kvar sitt borrow_mut under drain-loopen → 'RefCell already borrowed'-panik vid högerklick när en tidigare popover låg kvar i stacken. Stacken töms nu till en lokal Vec innan popdown körs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -179,8 +179,11 @@ fn register_popover(ctx: &Rc<Ctx>, popover: &impl IsA<gtk::Popover>) {
|
||||
})
|
||||
.unwrap_or(false);
|
||||
if !nested {
|
||||
for old in ctx.popover_stack.borrow_mut().drain(..) {
|
||||
old.popdown();
|
||||
// töm stacken FÖRE popdown — closed-hanterarna lånar också
|
||||
// stacken (popdown emittar closed synkront → dubbellåning annars)
|
||||
let old: Vec<gtk::Popover> = ctx.popover_stack.borrow_mut().drain(..).collect();
|
||||
for p in old {
|
||||
p.popdown();
|
||||
}
|
||||
}
|
||||
ctx.popover_stack.borrow_mut().push(p.clone());
|
||||
|
||||
Reference in New Issue
Block a user