diff --git a/src/app.cpp b/src/app.cpp index f6c3b07..0cb3a0c 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1790,19 +1790,22 @@ void App::ensureLogoTexture() // colour on light skins so it doesn't wash out against a light card/background. const ImU32 detailCol = wantDark ? IM_COL32(255, 255, 255, 255) : ui::material::OnSurface(); + // Replaced textures are retired, not freed: the deferred-destroy queue frees them at the next preFrame(), + // after every draw list that may still reference them has been rendered. + // ":drgx:" custom chat emoji — themed to the accent like the logo (re-rasterized on theme change). - if (drgx_emoji_tex_) util::DestroyTexture(drgx_emoji_tex_); + retireTexture(drgx_emoji_tex_); drgx_emoji_tex_ = 0; drgx_emoji_w_ = 0; drgx_emoji_h_ = 0; util::LoadTextureFromSvg(embedded::kLogoDragonXSvg, 96, logoAccent, detailCol, &drgx_emoji_tex_, &drgx_emoji_w_, &drgx_emoji_h_); - if (logo_tex_) util::DestroyTexture(logo_tex_); // free the previous texture before replacing + retireTexture(logo_tex_); // retire the previous texture before replacing logo_tex_ = 0; logo_w_ = 0; logo_h_ = 0; // Coin/currency icon (the big DragonX mark on the balance card) — the SAME themed SVG recolored to // the accent, rasterized here so it changes with the skin too (done first, since the header block // below early-returns on success). Falls back to the PNG coin icon if rasterization fails. - if (coin_logo_tex_) util::DestroyTexture(coin_logo_tex_); + retireTexture(coin_logo_tex_); coin_logo_tex_ = 0; coin_logo_w_ = 0; coin_logo_h_ = 0; coin_logo_loaded_ = true; if (!util::LoadTextureFromSvg(embedded::kLogoDragonXSvg, 128, logoAccent, detailCol, diff --git a/src/app.h b/src/app.h index 5c28f93..349e68d 100644 --- a/src/app.h +++ b/src/app.h @@ -690,8 +690,8 @@ public: // Diagnostic string describing daemon memory detection path (for debugging) const std::string& getDaemonMemDiag() const { return daemon_mem_diag_; } - // Background gradient overlay texture - void setGradientTexture(ImTextureID tex) { gradient_tex_ = tex; } + // Background gradient overlay texture (a replaced texture is retired, freed at the next preFrame()) + void setGradientTexture(ImTextureID tex) { if (tex != gradient_tex_) retireTexture(gradient_tex_); gradient_tex_ = tex; } ImTextureID getGradientTexture() const { return gradient_tex_; } // Logo texture accessor (wallet branding icon)