From: NeilBrown Date: Tue, 27 Jun 2023 01:43:32 +0000 (+1000) Subject: pane: if an on-idle event to handle damage cannot be added, don't add damage. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=8157ed13bbdec43f6b2f18ba037cd8f34a5daaac;p=edlib.git pane: if an on-idle event to handle damage cannot be added, don't add damage. If pane_damaged() is called before the event handler is ready, the on-idle doesn't get registered properly and will never get called. So check for errors, and leave damage unset so the next pane_damaged() call can schedule the on-idle event. Signed-off-by: NeilBrown --- diff --git a/core-pane.c b/core-pane.c index 3f91238f..c3055519 100644 --- a/core-pane.c +++ b/core-pane.c @@ -95,7 +95,9 @@ void pane_damaged(struct pane *p, int type) if (!p || (p->damaged | type) == p->damaged) return; if (p == p->parent && !p->damaged) - call_comm("event:on-idle", p, &pane_refresh, 1); + if (call_comm("event:on-idle", p, &pane_refresh, 1) <= 0) + /* Cannot register an event yet, ignore damage */ + return; if (type & (type-1)) { /* multiple bits are set, handle * them separately