]> git.neil.brown.name Git - edlib.git/commitdiff
pane: if an on-idle event to handle damage cannot be added, don't add damage.
authorNeilBrown <neil@brown.name>
Tue, 27 Jun 2023 01:43:32 +0000 (11:43 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 07:51:41 +0000 (17:51 +1000)
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 <neil@brown.name>
core-pane.c

index 3f91238f5a3e114794fc584bfbcdc96354ae4714..c30555194c5295314f3a3eec111b5375324a124a 100644 (file)
@@ -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