Ui: destroy the descriptor heap before the font atlas

Crafter.Graphics's FontAtlas now destroys its image when it goes. In sets
mode the heap holds a view of that image, so the heap must go first:
the atlas is declared before the heap, and dies after it.
This commit is contained in:
Jorijn van der Graaf 2026-10-18 01:16:35 +02:00
commit a373e1bf5a
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB

View file

@ -128,13 +128,14 @@ export namespace ImsdMessages::Ui {
class Canvas { class Canvas {
// Declared first so they die last: a layer's buffer slots hand their // Declared first so they die last: a layer's buffer slots hand their
// numbers back to the heap when they go, so the heap (and the // numbers back to the heap when they go, so the heap (and the
// renderer, which holds slots of its own) must still exist then. // renderer, which holds slots of its own) must still exist then. The
// Members are destroyed in the reverse order of their declaration, // atlas destroys its image and the heap, in sets mode, holds a view
// whatever their access. // of it, so the heap goes before the atlas. Members are destroyed in
// the reverse order of their declaration, whatever their access.
std::optional<Crafter::Window> window; std::optional<Crafter::Window> window;
Crafter::GraphicsDescriptorHeap heap;
std::optional<Crafter::Font> font; std::optional<Crafter::Font> font;
Crafter::FontAtlas atlas; Crafter::FontAtlas atlas;
Crafter::GraphicsDescriptorHeap heap;
Crafter::UIRenderer ui; Crafter::UIRenderer ui;
std::optional<Crafter::EventListener<Crafter::UIBuildArgs>> buildSub; std::optional<Crafter::EventListener<Crafter::UIBuildArgs>> buildSub;
std::optional<WordWrapper> wrapper; std::optional<WordWrapper> wrapper;