From 66067fabcbe6c2ae99fc83929ca9d2f33c8bbb50 Mon Sep 17 00:00:00 2001 From: xcws_52 Date: Mon, 22 Jun 2026 06:03:42 -0400 Subject: [PATCH] femu: repair pqueue using current heap relation --- hw/femu/lib/pqueue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/femu/lib/pqueue.c b/hw/femu/lib/pqueue.c index 0b25e43391..507e5cd3f4 100644 --- a/hw/femu/lib/pqueue.c +++ b/hw/femu/lib/pqueue.c @@ -147,14 +147,15 @@ int pqueue_insert(pqueue_t *q, void *d) void pqueue_change_priority(pqueue_t *q, pqueue_pri_t new_pri, void *d) { size_t posn; - pqueue_pri_t old_pri = q->getpri(d); q->setpri(d, new_pri); posn = q->getpos(d); - if (q->cmppri(old_pri, new_pri)) + if (posn > 1 && + q->cmppri(q->getpri(q->d[parent(posn)]), q->getpri(d))) { bubble_up(q, posn); - else + } else { percolate_down(q, posn); + } } int pqueue_remove(pqueue_t *q, void *d)