Wassimulator / CactusViewer

A small single file image viewer written in C/C++.
BSD 2-Clause "Simplified" License
203 stars 15 forks source link

Fixing a crash when opening a file in a large folder, and resolving a perf issue with the thumbs bar #45

Closed Aidanboneham closed 6 months ago

Aidanboneham commented 6 months ago

Resolves #44

I've added a new type called StableDynarray that uses VirtualAlloc to reserve a large block of memory so that the arrays can grow without moving the array, which causes a crash. This is kind of a halfway step towards using actual arenas. I saw the todo comment to move to arenas, but that seemed like a larger change.

I'm not sure what the policy is for platform specific stuff, so I can move the VirtualAlloc calls out to a separate file if desired.

I also changed the thumbs bar to only render the thumbs that are currently visible on screen. When there are a lot of files in the directory, adding the UI buttons for all of them really tanks perf.

Wassimulator commented 6 months ago

Appreciate the work! merged