fix: fix desktop app loading cap

This commit is contained in:
2026-07-08 10:00:45 +02:00
parent c4480a3bf2
commit ab8c24844e
4 changed files with 124 additions and 71 deletions
+12 -1
View File
@@ -174,7 +174,18 @@ static void launcher_add_item(DesktopState* ds, LauncherItemKind kind,
SvgIcon* icon, int ref_index,
const char* path = nullptr,
const char* keywords = nullptr) {
if (ds->launcher_item_count >= MAX_LAUNCHER_ITEMS) return;
if (ds->launcher_item_count >= ds->launcher_item_capacity) {
int new_cap = ds->launcher_item_capacity ? ds->launcher_item_capacity * 2 : 64;
auto* items = (LauncherItem*)montauk::realloc(
ds->launcher_items, (uint64_t)new_cap * sizeof(LauncherItem));
if (!items) return;
ds->launcher_items = items;
auto* results = (int*)montauk::realloc(
ds->launcher_results, (uint64_t)new_cap * sizeof(int));
if (!results) return;
ds->launcher_results = results;
ds->launcher_item_capacity = new_cap;
}
LauncherItem* item = &ds->launcher_items[ds->launcher_item_count++];
montauk::memset(item, 0, sizeof(LauncherItem));