fix: crash in home screen
Button click handlers may delete the button, so we should not touch self after calling them.
This commit is contained in:
parent
a0fa079a13
commit
932c79fb13
1 changed files with 2 additions and 2 deletions
|
|
@ -133,9 +133,9 @@ fn State(ctx_type: type) type {
|
|||
}
|
||||
return true;
|
||||
} else if (try m.match(.{ "B", input.event.release, tp.extract(&btn), tp.any, tp.extract(&x), tp.extract(&y), tp.any, tp.any })) {
|
||||
self.call_click_handler(@enumFromInt(btn), self.to_rel_cursor(x, y));
|
||||
self.drag_anchor = null;
|
||||
self.drag_pos = null;
|
||||
self.call_click_handler(@enumFromInt(btn), self.to_rel_cursor(x, y));
|
||||
tui.need_render();
|
||||
return true;
|
||||
} else if (try m.match(.{ "D", input.event.press, tp.extract(&btn), tp.any, tp.extract(&x), tp.extract(&y), tp.any, tp.any })) {
|
||||
|
|
@ -150,9 +150,9 @@ fn State(ctx_type: type) type {
|
|||
self.active = false;
|
||||
h.send(from, m) catch {};
|
||||
}
|
||||
self.call_click_handler(@enumFromInt(btn), self.to_rel_cursor(x, y));
|
||||
self.drag_anchor = null;
|
||||
self.drag_pos = null;
|
||||
self.call_click_handler(@enumFromInt(btn), self.to_rel_cursor(x, y));
|
||||
tui.need_render();
|
||||
return true;
|
||||
} else if (try m.match(.{ "H", tp.extract(&self.hover) })) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue