diff options
Diffstat (limited to 'builtins/array.c')
| -rw-r--r-- | builtins/array.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtins/array.c b/builtins/array.c index fe1712e7..aa6929d5 100644 --- a/builtins/array.c +++ b/builtins/array.c @@ -602,6 +602,8 @@ public void Array$heapify(array_t *heap, closure_t comparison, int64_t padded_it if (heap->data_refcount != 0) Array$compact(heap, padded_item_size); + // It's necessary to bump the refcount because the user's comparison + // function could do stuff that modifies the heap's data. ARRAY_INCREF(*heap); int64_t i, n = heap->length; for (i = (n >> 1) - 1 ; i >= 0 ; i--) |
