mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-22 11:46:11 +03:00

Fixes #1991 To check if a hyperlink from another page is already present in our page's set, we need to dupe the hyperlink struct. If the hyperlink is already present in our page, this dupe is a waste and is freed. In the case where the hyperlink is present AND we don't have enough memory to dupe the hyperlink to check if its present, we'd previous simply crash out and fail rendering. Debug builds would crash with integrity errors. This commit resolves the issue by falling back to a slow path when our string allocation table is full and iterating over the hyperlink map to check one by one if we have the hyperlink. This O(N) is much slower than allocating (in this case) but N is usually low on top of this case being rare. A better solution would probably be to ensure we always have some % of available space free in our string allocation table. This would result in some wasteful page reallocs but would speed up the render loop. We can look into that later.